六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 23|回复: 0

alert的一种替身

[复制链接]

升级  15.2%

176

主题

176

主题

176

主题

进士

Rank: 4

积分
576
 楼主| 发表于 2013-2-7 14:54:30 | 显示全部楼层 |阅读模式
详情见: 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');
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表