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
[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' /> <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]
Help @hefterr spread the word by sharing this article on Twitter...