View Full Version : how to pass dynamic variable to another div with onclick?

08-30-2010, 03:53 PM
Hello, I am trying to access a dynamic asp variable with onclick either in a javascript function where I can use it globally or set another div id with this dynamic variable.

Any help is very much appreciated. Thank you!

function doSomething(article_id)
return article_id;


<a href="#test" onClick="doSomething("<%=rsHeadline("article_id")%>")">try here...</a>

<div id="test">
<%articleid = request.querystring("article_id") %>
<% Response.Write articleid %>
The article id is articleid</div>

Old Pedant
08-30-2010, 09:26 PM
Make up your mind: If the value coming from the DB as in rsHeadline("article_id") or from the querystring as in request.querystring("article_id")????

It can't come from both. Or I certainly wouldn't expect it to.