-
Changing State
Hi All,
I have the following:
<a href="xyz.asp?Auto='y'#"><img src="./images/autoup_off.jpg" onmouseout="this.src='./images/autoup_off.jpg'" onmouseover="this.src='./images/autoup.jpg'" width="88" height="69" border="0" alt="Options">
When a user first goes onto this page it is called with just xyz.asp, when the user clicks on this image, then the page calls itself with Auto='y' and it all works.
However If the user clicks on this a secondtime, I want to set Auto='n'. How do I do this.
Regards
Bill Crawley
-
PHP Code:
<SCRIPT language="JavaScript"><!--
function redirectxyzasp() {
var dExpire;
if(GetCookie("Visits",0)==0) {
dExpire = new Date(2010,12,31,23,59,59);
setCookie("Visits",1,dExpire);
document.self.location="xyz.asp?Auto='y'#";
} else {
document.self.location="xyz.asp?Auto='n'#";
}
}
--></SCRIPT>
<a href="#" onClick=:"redirectxyzasp()";><img src="./images/autoup_off.jpg" onmouseout="this.src='./images/autoup_off.jpg'" onmouseover="this.src='./images/autoup.jpg'" width="88" height="69" border="0" alt="Options">
I think it gonna work, note the dExpire is used if the redirection to "xyz.asp?Auto='Y'#" have to persist for further visits.
If you don't have the Cookies library, download them:
-
1 Attachment(s)
Ops! I forgot putting the file
Sorry :D