1、警告对话框:带一个确定按扭。
<script language=javascript>
alert('对话框显示的文本');
window.location='点确定按扭时跳转到的页面';
</script>
2、选择对话框:带确定和取消按扭。
<script language='javascript'>
if (confirm('对话框显示的文本'))
window.location='点确定按扭时跳转到的页面';
else
window.location='点取消按扭时跳转到的页面';
</script>
将他们写成ASP函数,方便调用:
'----弹出对话框1(带确定按钮,点击后返回指定链接)----
'使用示例Message1(MyPageInfo&"修改成功!",MyCgiUrl&"?MyPage="&strMyPage)
Sub Message1(MessageText,ReturnUrl)
Response.Write(""&_
"<script language=javascript>"&_
"alert('"&MessageText&"');"&_
"window.location='"&ReturnUrl&"';"&_
"</script>"&_
"")
Response.End
End Sub
弹出对话框2(带确定和取消按钮,点击后各自返回各自指定链接)
'使用示例Message2("确定要删除此类别?",MyCgiUrl&"?
MyMode=Del&ID="&strID&"&MyPage="&strMyPage,"javascript:window.history.back();")
Sub Message2(MessageText,ReturnUrl,CancelReturnUrl)
Response.Write(""&_
"<script language=javascript>"&_
"if (confirm('"&MessageText&"'))"&_
" window.location='"&ReturnUrl&"';"&_
"else"&_
" window.location='"&CancelReturnUrl&"';"&_
"</script>"&_
"")
Response.End
End Sub

- 评论:(0)
发表评论 点击这里获取该日志的TrackBack引用地址