Results 1 to 3 of 3

Thread: Changing State

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    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

  2. #2
    Junior Member
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    29
    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:

  3. #3
    Junior Member
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    29
    Ops! I forgot putting the file
    Sorry
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width