Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable in the url

Status
Not open for further replies.

dcarbone

Programmer
Aug 22, 2003
29
CA
<a href=&quot;<%= response.write(dst) %>&quot;onclick=&quot; openindex(); return false;&quot;>

i'm using this link code to open a new window, how would i pass the value of response.write(dst) to the new window code
 
ideally your openindex() function would accept a parameter, like so:

function openindex(url) {
var myWin = window.open(url);
}

then you could say
<a href=&quot;<%= response.write(dst) %>&quot;onclick=&quot; openindex('<%= response.write(dst) %>'); return false;&quot;>

or
<a href=&quot;<%= response.write(dst) %>&quot;onclick=&quot; openindex(this.href); return false;&quot;>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
>>how would i pass the value of response.write(dst) to the new window code

Do you mean passing this value to the openindex() function? If so you can do it the same way you put it in the link. Btw, Response.write is not necessary for this.
Code:
<a href=&quot;<%=dst%>&quot;onclick=&quot; openindex('<%=dst%>'); return false;&quot;>
Remember to encapsulate your url string in quotes when passing it to the function.


-kaht

banghead.gif
 
hey,

it will depend a little on what goes on in your openindex function. To pass the value on a URL variable would be simple enough:

<a href=&quot;pagetoopen.asp?v=<%=dst%>&quot; onclick=&quot;openindex();return false;&quot;>

notice <%= is short for response.write so you don't have to use both.

then the URL variable &quot;v&quot; will be available to the opened page. If the function &quot;openindex&quot; is opening a window with a different URL then you will want to put the &quot;?v=<%=dst%>&quot; part with the URL that is being opened.

I hope that is clear enough.


Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
Jemminger is becoming notorious for pressing the submit button 10 seconds before me :)

-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top