1.无提示刷新网页
你们有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“肯定”才会刷新。
而有的页面不会提示,不弹出提示窗口,直接就刷新了.
若是页面没有form,
则不会弹出提示窗口
若是页面有form表单,
a)<form method="post" ...>
会弹出提示窗口
b)<form method="get" ...>
不会弹出
2 java刷新页面的方法
location.reload();
使用open()弹出的弹出窗口,刷新父窗口
opener.location.reload()
使用showDialog弹出的模式窗口
dialogArguments.location.reload();
3.java弹出窗口代码
下面给两个弹出屏幕居中窗口的例子
open()方式
ShowDialog(url)
{
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(screen.height-iHeight)/2;
var iLeft=(screen.width-iWidth)/2;
open(url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
}
showModalDialog方式
ShowDialog(url) {
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(screen.height-iHeight)/2;
var iLeft=(screen.width-iWidth)/2;
showModalDialog(url,window,"dialogHeight: "+iHeight+"px; dialogWidth: "+iWidth+"px;dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no;scroll:no");
}
注意这里的第二个参数,window
4.模式窗口数据不刷新(缓存)问题
在jsp页面加入以下语句
<%
response.setHeader("Pragma","No-Cache");
response.setHeader("Cache-Control","No-Cache");
response.setDateHeader("Expires", 0);
%>
5,模式窗口中,连接弹出新窗口问题
在</head>和<body>间加入<base target="_self">
6.无提示关闭页面的方法
CloseWin() { var ua = navigator.userAgent; var ie = navigator.appName=="Microsoft Internet Explorer"?true:false; if(ie) { var IEversion = parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))); if( IEversion< 5.5) { var str = ''; body.insertAdjacentHTML("beforeEnd", str); all.noTipClose.Click(); } else { opener =null; close(); } } else { close() } }