/    Sign up×
Community /Pin to ProfileBookmark

cancel javabox pop up

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 ?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@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>&lt;script type="text/javascript"&gt;&lt;!--
var true_or_false=confirm("Yes or No?")
alert(true_or_false)
//--&gt;&lt;/script&gt;


To ignore all confirms and simulate a "CANCEL" push every time, you can over-ride the function like so:
<i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
window.confirm=function(){return false}
var true_or_false=confirm("Yes or No?")
alert(true_or_false)
//--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@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
Copy linkTweet thisAlerts:
@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>&lt;script type="text/javascript"&gt;&lt;!--
window.confirm=function(){return false}
var true_or_false=confirm("Yes or No?")
document.write(true_or_false)
//--&gt;&lt;/script&gt;


here's one that doesn't tell you what you picked:
<i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
window.confirm=function(){return false}
var true_or_false=confirm("Yes or No?")
//--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@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>&lt;script type="text/javascript"&gt;&lt;!--
window.confirm=function(){return false}
//--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@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?
Copy linkTweet thisAlerts:
@UltimaterApr 17.2005 — place the following in your HEAD tag:
<i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
window.confirm=function(){return false}
window.alert=function(){return false}
//--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@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 ?
Copy linkTweet thisAlerts:
@UltimaterApr 18.2005 — np

I hope you stick around on these forums, they are very educational!
×

Success!

Help @comte spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...