Results 1 to 4 of 4

Thread: Passing variables

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry Passing variables

    Hello,

    I have this code and what I'm trying to do is send a variable from my hyperlink code to
    the OpenWindow function. I'll then send this variable using querystrings to another ASP
    page where I'll then use it.

    1.)
    Code:
    <a href="javascript:OpenWindow('testing123');">Test sending var</a>

    2.)
    Code:
    <script language="JavaScript"> 
    <!--
         function OpenWindow(myVar)
         { window.open("specials.asp?yourVar=myVar","NewWindow","width=400,height=400,noresize,scrollbars=yes,toolbar=0,menubar=0");
         }
    // end popup windows -->
    </script>


    3.)
    In specials.asp I'll then do this, and hopefully var = "testing123"

    Code:
    <%
    dim var 
    
    var = request.querystring(yourvar)
    
    %>

    Thanks,
    T

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I presume it doesn't work then!


    Try this ( I haven't tested it)
    Code:
    <HTML>
    
    <script language="JavaScript"> 
    <!--
         function OpenWindow(myVar)
         { 
    	var url = "specials.asp?yourVar=" + myVar
    	window.open(url,"NewWindow","width=400,height=400,noresize,scrollbars=yes,toolbar=0,menubar=0");
         }
    // end popup windows -->
    </script>
    
    <BODY>
    
    <a href="javascript:OpenWindow('testing123');">Test sending var</a>
    </BODY>
    </HTML>
    Code:
    <%
    dim var 
    
    var = request("yourvar")
    
    %>
    Mark
    -------------------

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I've no idea why it's put a space in "javascript". It's not there if I edit it
    Mark
    -------------------

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    Hi Mark,

    Thank you very much!! Your code works 100%.

    T

Posting Permissions

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



Click Here to Expand Forum to Full Width