日期:2014-05-16 浏览次数:20407 次
if (confirm("此操作不可逆转,你确定进行此操作?")) { //....操作代码 }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>test</title> <style> #all{ width:270px; height:80px; background:#999; position:absolute; z-index:1000; display:none; border:1px solid red; } #message{ width:100%; height:40px; } #ok{ margin-left:80px; } </style> <script src="jquery-1.3.2.js"></script> <script> $(function(){ $("#btn").click(function(){ $("#all").show(); }); $("#ok").click(function(){ $("#all").hide(); }); $("#cancle").click(function(){ $("#all").hide(); return; }); }); </script> </head> <body> <input type="button" value="测试" id="btn" onclick="test()" /> <div id="all"> <div id="message">此操作不可逆转,你确定进行此操作?</div> <input type="button" value="确定" id="ok" /> <input type="button" value="取消" id="cancle" /> </div> </body> </html>