1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is the browser setting problem

Discussion in 'Web Design, HTML And CSS' started by lieweffect, Mar 16, 2007.

  1. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    I write the following script:
    Code:
     function confirmSubmit()
     {
     var agree=confirm("You are now leaving*the website and link to the third party website. Do you wish to continue?");
     if (agree)
         return true ;
     else
         return false ;
     }
    It works, but some of my users said whenever they click 'Cancel' they still can link to other site.(In IE 7), but it function properly in other IE 7 in different computer.
    (It work in properly in Opera)

    So, may I know is the browser setting problem or the script problem?
     
    Last edited by a moderator: Mar 16, 2007
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    Please post the code where you are calling this function!
     
  3. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Code:
    function confirmSubmit()
    {
      var agree=confirm("You are now leaving*the website and link to the third party website. Do you wish to continue?");
       if (agree)
          return true ;
       else
         return false ;
     }
    
    Note that you are expecting confirmSubmit to return true or false; if it is true, you return true, otherwise you return false. This action could just as well be coded by:
    Code:
       return confirm ("blah blah blah");
    
    which, in turn, could be replaced with confirm, and toss confirmSubmit entirely.

    The problem, however, lies in the definition of true and false. I think you may solve your problem if you use the following:
    Code:
    if  (!confirm ("blah blah blah")) return false; else return true;
    
     

Share This Page