View Full Version : problem with onclick

03-17-2004, 12:32 AM
Hello, in a iframe, I've a list of links on a page. witch one loads db record on a page in the same window where iframe is.
iframe is in "main" window.

this code works well

<a href="xpto.asp?test=<%&rs("nuser")&%>" target="main" style="width:45; text-align:center;"><%&rs("nuser")&%></a>

this code dosn't work.

<a href="" target="main" style="width:45; text-align:center;" onClick="javascript:window.location.href=xpto.asp?test=<%&rs("nuser")&%>"> <%&rs("nuser")&%> </a>

ie return this: "Directory Listing Denied. This Virtual Directory does not allow contents to be listed."

Please somebody....

03-17-2004, 02:45 AM
This is a javascript question, not asp.

<a href="" target="main" style="width:45; text-align:center;" onClick="javascript:window.location.href='xpto.asp?test=<%&rs("nuser")&%>'"> <%&rs("nuser")&%> </a>

Need the single quotes around the url after href=

03-18-2004, 03:26 PM
Nightfire is right... but for clarity's sake I'm going to move this post to the JavaScript forum for any further questions.

By the way, I usually use <% = variablename %> for inline ASP code... I've never seen the <% & variablename & %> syntax. Does that actually work? I'll have to try it later. :)