|
|
详情见: http://sandbox.leigeber.com/dialog/dialog_box.html 原文
此连接提供的有效果图和代码下载
自已改写了部分代码:
<!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=GBK" />
<title>Custom JavaScript Dialog Boxes</title>
<link rel="stylesheet" type="text/css" href="dialog_box.css" />
<script type="text/javascript" src="dialog_box.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
// hide the dialog box //
// 此处将隐藏DIV代码提取出来--- 以便关闭时,转向其它页面
function hideDialog() {
var dialog = document.getElementById('dialog');
clearInterval(dialog.timer);
dialog.timer = setInterval("fadeDialog(0)", TIMER);
// 新增如下语句
location.href="a.html";
}
//-->
</SCRIPT>
</head>
<body>
<!-- 下面div必有-->
<div id="content">
</div>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
showDialog('Success','登录成功','success');
// alert("登录成功!");
// location.href="a.html";
//-->
</SCRIPT>
使用总结:
1.引入JS和CSS;
2.重写关闭事件触发方法;
3.body中加入
<div id="content">
</div>
4.JS调用showDialog('Success','登录成功','success'); |
|