Michael Kragh Pedersen wrote:
[color=blue]
> 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?[/color]
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?f oo=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.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Michael Kragh Pedersen wrote:
[color=blue]
> 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?[/color]
<a href="add.asp"> add</a>
then add.asp increments the (Session?) variable and makes sure it
doesn't send a response body by setting the correct HTTP response header
e.g.
Response.Status = "204 no content"
That way when the link is clicked the browser makes the HTTP request to
the server for add.asp but as long as the server answers with 204 as the
HTTP response status code the page with the link is not changed.
That has nothing to do with client-side JavaScript then obviously.
David Dorward wrote on 19 feb 2005 in comp.lang.javas cript:
[color=blue]
> Michael Kragh Pedersen wrote:
>[color=green]
>> 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?[/color]
>
> 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?f oo=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.
>[/color]
=== test.html:
Only this iframe will refresh:<br>
<iframe src="test.asp"> </iframe>
=============== =============== ====
=== test.asp:
<%
Response.Expire s = 0
if session("count" ) = "" then session("count" ) = 0
session("count" ) = session("count" )+1
%>
Count is now: <%=session("cou nt")%><br>
<a href="test.asp" >Click to increment</a>
=============== =============== =====
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
Comment