模拟的Alert("conent:内容;title:标题")
1.htm和b.htm放在同一目录<!--1.htm-->
<script language="JavaScript">
<!--
function Alert(strText){
var pWin=window.showModalDialog("b.htm",strText,"dialogHeight:116px; dialogWidth:232px; help: No; resizable: no; status: No; scroll:no; dialogTop:"+(screen.height-116)/2+"px; dialogLeft:"+(screen.width-232)/2+"px;");
}
Alert("content:警告内容部分?;title:警告标题;");
//-->
</script> -------------------------------------------------
<!--b.htm-->
<html>
<head>
<style type="text/css">
body{ }
td,input{ font-size:12px}
</style>
<script language="JavaScript">
<!-- var str = window.dialogArguments;
var getAttribute=function(source, name)
{
var reg = new RegExp("(^|;|\\s)"+ name +"\\s*:\\s*([^;]*)(\\s|;|$)", "i");
if (reg.test(source))
return RegExp.$2.replace(/[\x0f]/g, ";").replace(/\'/g, "'"); return "";
}; function doOk(){
window.returnValue="yes";
window.close();
}
document.write('<title align="center">'+getAttribute(str,"title")+' </title>');
//-->
</script>
</head>
<body style="background-color:buttonface; margin:0">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr height="65%">
<td width="25%" align="center" valign="center"><img src="http://home.nuc.edu.cn/~chandler/images/warning.jpg" style="width:32px; height:32px"></td>
<td valign="middle">
<script language="JavaScript">
<!--
document.write(getAttribute(str,"content"));
//-->
</script>
</td>
</tr>
<tr height="35%">
<td colspan="2" align="center" valign="top">
<input type="button" id="btnOk" value=" 确定 " style="width:80px;" onclick="doOk()"> </td>
</tr>
</table>
</body>
<script language="JavaScript">
<!--
document.onclick=function (){
document.getElementById("btnOk").focus();
}
document.body.oncontextmenu=function (){
document.getElementById("btnOk").focus();
}
//-->
</script>
<html>
1.htm和b.htm放在同一目录<!--1.htm-->
<script language="JavaScript">
<!--
function Alert(strText){
var pWin=window.showModalDialog("b.htm",strText,"dialogHeight:116px; dialogWidth:232px; help: No; resizable: no; status: No; scroll:no; dialogTop:"+(screen.height-116)/2+"px; dialogLeft:"+(screen.width-232)/2+"px;");
}
Alert("content:警告内容部分?;title:警告标题;");
//-->
</script> -------------------------------------------------
<!--b.htm-->
<html>
<head>
<style type="text/css">
body{ }
td,input{ font-size:12px}
</style>
<script language="JavaScript">
<!-- var str = window.dialogArguments;
var getAttribute=function(source, name)
{
var reg = new RegExp("(^|;|\\s)"+ name +"\\s*:\\s*([^;]*)(\\s|;|$)", "i");
if (reg.test(source))
return RegExp.$2.replace(/[\x0f]/g, ";").replace(/\'/g, "'"); return "";
}; function doOk(){
window.returnValue="yes";
window.close();
}
document.write('<title align="center">'+getAttribute(str,"title")+' </title>');
//-->
</script>
</head>
<body style="background-color:buttonface; margin:0">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr height="65%">
<td width="25%" align="center" valign="center"><img src="http://home.nuc.edu.cn/~chandler/images/warning.jpg" style="width:32px; height:32px"></td>
<td valign="middle">
<script language="JavaScript">
<!--
document.write(getAttribute(str,"content"));
//-->
</script>
</td>
</tr>
<tr height="35%">
<td colspan="2" align="center" valign="top">
<input type="button" id="btnOk" value=" 确定 " style="width:80px;" onclick="doOk()"> </td>
</tr>
</table>
</body>
<script language="JavaScript">
<!--
document.onclick=function (){
document.getElementById("btnOk").focus();
}
document.body.oncontextmenu=function (){
document.getElementById("btnOk").focus();
}
//-->
</script>
<html>
解决方案 »
- 求助求助Ext4.0(对Ext.app.Portal的理解)----不知道的帮顶顶哦
- 如何在选着了单选框radio后触发函数
- 这个网站主要用到的JS是什么呢?
- 求助 GOOGLE MAP API3 中清除图标太慢、、有没有更好的方法。。
- 请问递归函数怎么不用全局变量保存运行时信息?
- 帮帮忙急啊
- 在线等答案:经过URL重写到本页,页面刷新以后,如何选中select中曾经选中的option??
- JavaScript中格式化字符串如何实现?
- 如何在动态生成表格中加上事件?
- 已知一个图像的文件名,怎么知道这个图像的长宽?
- 求一个用w3c的DOM动态生成table的例子
- 怎样给动态生成的表格的td添加事件呢?
execScript("msgbox '测试1',0,'测试2' ","vbscript")
</script>
感谢楼主我刚刚完成了一个很粗糙的版本
由于 HTWindow 也在同步修改
所以漏洞多多
请大家多指教demo http://hotoo.ik8.com/demo/javascript/HTAlert.html如果要模拟 confirm() 则比较困难
因为需要阻断进程(或线程)
而alert()只是一个提示
可以不需要阻断进程(或线程)