确认消息框包含“确定”和“取消”按钮,提出的问题将有两种可能的结果。confirm 方法返回 true 和 false。此消息框也是模式:用户必须响应(单击某个按钮)继而关闭它之后才能继续。<!--以下为具体使用例子-->
var truthBeTold = window.confirm("Click OK to continue. Click Cancel to stop.");
if (truthBeTold)
window.alert("Welcome to our Web page!");
else
window.alert("Bye for now!");
var truthBeTold = window.confirm("Click OK to continue. Click Cancel to stop.");
if (truthBeTold)
window.alert("Welcome to our Web page!");
else
window.alert("Bye for now!");
--
搞小一些,然后把色彩变变OK
window.confirm=function(str)
{
var html="\
<div align='center'>\
<div style='border:2px outset buttonlight;background:buttonface;width:400px;height:100px;'>\
<div style='height:20px;background:highlight;font:caption;color:white;padding:2 0 0 10;text-align:left;'>blueDestiny confirm:</div>\
"+str+"\
<div><INPUT TYPE='radio' NAME=''><INPUT TYPE='radio' NAME=''></div>\
<div style='padding:20px;'><input type='button' onclick='alert(\"yes\")' value='YES'> <input type='button' onclick='alert(\"no\")' value='N O'></div>\
</div></div>\
"
document.write(html);
}
confirm("blueDestiny,never-online")
</script>