/    Sign up×
Community /Pin to ProfileBookmark

Confirm Method Question

Hi,
I am a JS newbie so this may be a simple question.

Is there a way to customize the results from a confirm() method/box? In other words, could I use my own button images and throw a company logo in the window?

Thanks in advance?

hefterr

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@svidgenOct 12.2009 — Nope, don't think so. But, you could build a DHTML solution.
Copy linkTweet thisAlerts:
@rnd_meOct 12.2009 — [CODE]function _showModal(URL,r,w,h){
return window.showModalDialog(URL, r , " resizable: yes; center: on; dialogwidth: "+(w||370)+"; dialogheight: "+(h||175)+"; dialogtop:" + innerHeight * 0.3 + "; dialogleft: " + innerWidth * 0.4 + "; ");
}

function _confirm(content,ok,cancel,pre,w,h) {
var URL = dataUrl( (pre||"")+"<style>pre{position: relative; overflow: auto;}ninput{-moz-border-radius : 6px; cursor:pointer;font:150% menu bold;background:#4f4;border:2px outset;padding: 0.2em; min-width: 4em;margin:0.2em }ninput:hover{color:#fff;}</style><body bgcolor='#eeeefe' onload='el("ok").focus();'><script>window.onresize=function(){el("D").style.height=''; onresize=null;}; function el(tid) {return document.getElementById(tid);}</script><center><input type='button' value='"+(ok||' OK ')+"' onclick='returnValue=true;window.close()' id='ok' /> &nbsp; &nbsp; <input type='button' value='"+(cancel||'Cancel')+"' style='background:#f77;font-size:125%' onclick='window.close()' /><pre id='D' style='height: 220px;'>"+(content||"")+"</pre>", "text/html" );
return _showModal(URL,[content],330,310);
}

function dataUrl(data) {return "data:text/html," + escape(data);}


//test:
_confirm("are ya sure?")[/CODE]
Copy linkTweet thisAlerts:
@hefterrauthorOct 12.2009 — Hi rnd me,

I can't seem to run your script and it's a bit complex for me to debug?

Thanks,

hefterr
×

Success!

Help @hefterr 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.15,
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,
)...