這篇文章主要介紹的是一個js確認刪除對話框適用於a標簽及submit,非常好用,需要的朋友不要錯過
<!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=gb2312" />
<title>js確認刪除對話框</title>
</head>
<body>
<p>
<script language="javascript">
function delcfm() {
if (!confirm("確認要刪除?")) {
window.event.returnValue = false;
}
}
</script>
<a href="http://www.jb51.net/" onClick="delcfm()">刪除</a></p>
<p>代碼說明:單擊刪除的超鏈接後將執行delcfm()函數,在對話框中,如果點擊“確定”,
函數將返回true值,就將頁面轉到<a>標簽中的鏈接頁面執行刪除的頁面;
如果點擊“取消”,函數將返回false值,<a>標簽將不轉到執行刪除的頁面。</p>
<p>查找更多代碼,請訪問:<a href=http://www.jb51.net target="_blank">腳本之家</a></p>
</body>
</html>