Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation JavaScript Frames & QueryString

    Hi,
    I actually want to create a HTML page which has the capablity of reading a QueryString (x.html?querystring=test) and then using a hidden frame pass on the data to an ASP Script on another server.
    For obtaining the QueryString i use the following:-
    Code:
    <script>
    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      } 
    }
    </script>
    
    <script>
      alert( getQueryVariable("QueryString") );
    </script>
    Now my problem is to create a dynamic frame(hidden) who's location chnges according to the QueryString like
    Code:
    http://someserver.com/sample.asp?QuerySting=TheValueGivenToTheHTMLFile
    Thanks in Advance
    Last edited by prakharbirla; 05-30-2006 at 03:41 AM. Reason: URL

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    If I understand correctly, with

    http://someserver.com/sample.asp?iframepage.htm"

    The following would go in sample.asp

    <script type="text/javascript">

    if (location.search.length > 0){
    url = unescape(location.search.substring(1))
    document.write('<iframe src="'+url+'" src="blank.htm" style="position:absolute;left:0px;top:-500px;visibility:hidden"></iframe>')
    }

    </script>

    I have an example of usng an hidden iframe here

    http://www.huntingground.freeserve.c...ame_hidden.htm
    Last edited by Mr J; 06-02-2006 at 11:26 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •