1.无提示刷新网页 大家有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“确定”才会刷新。 而有的页面不会提示,不弹出提示窗口,直接就刷新了。 如果页面没有form,则不会弹出提示窗口。如果页面有form表单, a) 会弹出提示窗口 b) 不会弹出 2.javascript刷新页面的方法 window.location.reload(); 使用window.open()弹出的弹出窗口,刷新父窗口 window.opener.location.reload() 使用window.showDialog弹出的模式窗口 window.dialogArguments.location.reload(); 3.javascript弹出窗口代码 下面给两个弹出屏幕居中窗口的例子window.open()方式 function ShowDialog(url) { var iWidth=300; //窗口宽度 var iHeight=200;//窗口高度 var iTop=(window.screen.height-iHeight)/2; var iLeft=(window.screen.width-iWidth)/2; window.open( url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no, Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft ); } window.showModalDialog方式 function ShowDialog(url) { var iWidth=300; //窗口宽度 var iHeight=200;//窗口高度 var iTop=(window.screen.height-iHeight)/2; var iLeft=(window.screen.width-iWidth)/2; window.showModalDialog( url,window,"dialogHeight: "+iHeight+"px;dialogWidth: "+iWidth+"px; dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no;scroll:no" ); } 注意这里的第二个参数,window 4.模式窗口数据不刷新(缓存)问题 在jsp页面加入如下语句 5.模式窗口中,链接弹出新窗口问题 在和间加入 6.无提示关闭页面的方法 function 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 var str = ; document.body.insertAdjacentHTML("beforeEnd", str); document.all.noTipClose.Click(); } else { window.opener =null; window.close(); } }else{ window.close() } }7 这次在开发过程中用到了模态弹出对话框,但这个函数会有缓存,很是烦恼,在网上查了查相关的资料,发现了一种解决的方法,在这里记录下,主要是在给弹出的窗口的页面加上个时间参数,这样就不会有缓存了,如下:'javascript'> var time = new Date(); window.showModalDialog("newWin.html?time="+time,"","");