在showModalDialog窗口中,我按提交后又出来一个新窗口,怎样才能不这样啊?急啊!
方法1:
在这个页面的外面套一个iframe
方法2:
在这个页面的head里加上这句:
<base target="_self"/>
方法1:例子(网上收集未验证)
window.showModalDialog的用法,form表单提交不弹出新窗口
用frame把form表单包含起来index.html
<html>
<head>
<script>
function showDialog(url,argv,dialogHeight,dialogWidth){
var sFeatures="dialogHeight:"+dialogHeight+"px;dialogWidth:"+dialogWidth+"px;status:0;"
return window.showModalDialog(url,argv,sFeatures);
}
function doShow()
{
var timestamp = Date.parse(new Date());
showDialog("frame.html?timestamp="+timestamp,null,500,650);
}
</script>
</head><body>
<form>
<input type ="button" οnclick="doShow();return fasle" value="Test"/>
</form>
</body>
</html> frame.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
if(window.location.search) alert(window.location.search)
</script>
<frameset cols="0,*" frameborder="NO" border="0" framespacing="0">
<frame src="about:blank">
<frame src="form.html">
</frameset>
<noframes><body>
</body></noframes>
</html> from.html
Javascript Timestamp
Javascript拿到当前时间戳
<html>
<head>
<title>Javascript Timestamp Javascript拿到当前时间戳</title>
<script>
function timestamp(){
var timestamp = Date.parse(new Date());
return timestamp;
}
</script>
</head>
<body>
<form method="POST" target="_self">
<!--
<input type="button" οnclick="alert(timestamp())" value="JavaScript-Timestamp-Test-Button"/>
-->
<input type="input" name=""/>
<input type="submit" value="Test" />
</form>
<script>
if(window.location.search) alert(window.location.search)
</script>
</body>
</html>