Ok, the two things are completely different and they involve completely different solutions.
The HTML part could be:
And finally our ASP code:
<form id="form1" runat="server">
<a href="#" onclick="GetHidden();" >Click Here</a>
<input type="hidden" id="txt1" name="txt1" value="ourTestValue" />
Simple as that.
var JSVariable = <%=ASPVariable%>
I hope you find the post interesting enough. Keep on following the web thought.
PS: this is the 400th post! Wow, I couldn't believe it when I saw it.