is there a code which can cancel a javascrip box pop up, i’m not sure about their real names, the ones with the “ok” and “cancel” buttons, i need one for my website, can’t find it anywhere ?.
PS this ISN’T to get out of a free hosting advertisers ?
@UltimaterApr 17.2005 — #A dialog box with "OK" and "CANCEL" is called a [color=royalblue]confirm[/color] dialog box in javascript.
an example: <i> </i><script type="text/javascript"><!-- var true_or_false=confirm("Yes or No?") alert(true_or_false) //--></script>
To ignore all confirms and simulate a "CANCEL" push every time, you can over-ride the function like so: <i> </i><script type="text/javascript"><!-- window.confirm=function(){return false} var true_or_false=confirm("Yes or No?") alert(true_or_false) //--></script>
@comteauthorApr 17.2005 — #nope, it doesn't work, all it does is come up with two pop ups now, one saying "false" and an option "ok" then with the same one i was getting before, i think this maybe due to the one i am getting before has no cancel option on it, it only has an "ok" option
@UltimaterApr 17.2005 — #LOL... it's called an alert! It's to inform you which value you picked!
Here, This script will write the value to the screen: <i> </i><script type="text/javascript"><!-- window.confirm=function(){return false} var true_or_false=confirm("Yes or No?") document.write(true_or_false) //--></script>
here's one that doesn't tell you what you picked: <i> </i><script type="text/javascript"><!-- window.confirm=function(){return false} var true_or_false=confirm("Yes or No?") //--></script>
@UltimaterApr 17.2005 — #You aren't JavaScript illiterate, are you? If so, post your code or provide a link to your website and I'll tell you what changes to make.
All you should need to do is add the following in your script somewhere: <i> </i><script type="text/javascript"><!-- window.confirm=function(){return false} //--></script>
@comteauthorApr 17.2005 — #lol, sorry, english isn't part of my everyday rouine anymore ?
it still doesn't work, i get the same message i had before i put the new code in, ? i guess it could be on another file, not the one i'm puting it on, is there not one that will over-rule ALL the confi boxes and alerts in the sub directory?
@UltimaterApr 17.2005 — #place the following in your HEAD tag: <i> </i><script type="text/javascript"><!-- window.confirm=function(){return false} window.alert=function(){return false} //--></script>
@comteauthorApr 17.2005 — #doesn't matter, that very last one you posted works.... i think i made a typo or something before :eek: , thanks for your help ?