Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   Is the browser setting problem (http://www.go4expert.com/forums/browser-setting-t3424/)

lieweffect 16Mar2007 07:39

Is the browser setting problem
 
I write the following script:
Code: JavaScript

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?

pradeep 16Mar2007 14:47

Re: Is the browser setting problem
 
Please post the code where you are calling this function!

DaWei 21Mar2007 22:59

Re: Is the browser setting problem
 
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;


All times are GMT +5.5. The time now is 11:40.