一个用showModalDialog打开窗口,用window.returnValue返回值的例子
2009-03-18 20:30:04| 分类:
个人日记
| 标签:
|举报
|字号大中小 订阅
http://mail.139.com RSS 资讯中心 编辑RSS种子的时候 使用了showModalDialog方法。
<!--a.htm-->
<script language="JavaScript">
<!--
/*@cc_on @*/
/*@if (@_win32 && @_jscript_version>=5)
function window.confirm(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;");
}
@end @*/
confirm("真的要删除吗?");
//-->
</script>
<!--b.htm-->
<html>
<head>
<style type="text/css">
body{ }
td,input{ font-size:12px}
</style>
<script language="JavaScript">
<!--
var str = window.dialogArguments;
function doOk(){window.returnValue="yes";window.close();}
function doCancel(){window.returnValue="no";window.close();}
var timer=null;
function setTimer(){timer=window.setTimeout("doOk()",3000);}
document.onclick=function (){document.getElementById("btnOk").focus();}
document.oncontextmenu=function (){document.getElementById("btnOk").focus();}
//-->
</script>
<title align="center">--==提示信息==--</title>
</head>
<body style="background-color:buttonface; margin:0" onload="setTimer();">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr height="65%">
<td width="25%" align="center" valign="center"><img
src="warning.gif" style="width:32px; height:32px"></td>
<td valign="middle">
<script language="JavaScript">
<!--
document.write(str);
//-->
</script>
</td>
</tr>
<tr height="35%">
<td colspan="2" align="center" valign="top">
<input type="button" id="btnOk" value=" 确定 " onclick="doOk()">
<input type="button" id="btnOk" value=" 取消 " onclick="doCancel()">
</td>
</tr>
</table>
</body>
<html>
------------------
陈龙
QQ:84047848
MSN:dragonchen82@hotmail.com
评论这张
转发至微博
转发至微博
评论