David Dorward wrote on 19 feb 2005 in comp.lang.javascript
:
Michael Kragh Pedersen wrote:
I want to increment a ASP variable by 1, each time I click on a A
HREF (by onClick). Is that at all possible in any way?
You need to make an HTTP request to the server so that the ASP is
executed again.
The simpliest way to do this is: <a href="foo.asp?foo=4"> where '4' is
generated by the ASP script.
No JavaScript involved.
You could do more complex things with XMLHTTP, but that results in
reduced browser support.
=== test.html:
Only this iframe will refresh:<br>
<iframe src="test.asp"></iframe>
==================================
=== test.asp:
<%
Response.Expires = 0
if session("count") = "" then session("count") = 0
session("count") = session("count")+1
%>
Count is now: <%=session("count")%><br>
<a href="test.asp">Click to increment</a>
===================================
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)