其实我已经说得很清楚了...
<script language="jscript"" >
function confirm(e){
if (event.srcElement.type=="submit" &&
document.all(event.srcElement.name).value =="删除") // DataGrid列中按钮上的 TEXT (在此是"删除")
event.returnValue =alert_confirmdelete();
}
document.onclick=confirm;
//只要网页上有CLICK事件,均由confirm进行拦截
//因为是JaveScript, 此时网页并未提交, 时机刚好合适
function alert_confirmdelete(){
if(ie4 || ie5){
// if its IE4+ call the VB Script
retVal = makeMsgBox("请确认","真的要删除?",32,1,256,4096);//调用此函数的目的仅仅是要将确认框中的按钮定位在"否"上
// which button was pressed?
if(retVal == 1) {return true;} //"是"则网页继续提交
else
if (retVal == 2) {return false;}//"否"则中止提交
} else
{
// else
use a simple alert
alert("I am not IE");
}
}
</script>
<script language="VBScript">
<!--
Function makeMsgBox(tit,mess,icon,buts,defs,mode)
butVal = icon + buts + defs + mode
makeMsgBox = MsgBox(mess,butVal,tit)
End Function
// -->
</script>
思路:
用JSCRIPT拦截CLICK事件, 如果是"删除", 则调用VBSCRIPT函数(为了将"否"定制为默认)询问 -- 目的: 提交网页前进行确认