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?
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;