JS弹出新窗口 素颜马尾好姑娘i 2022-08-14 00:52 263阅读 0赞 在项目开发中,遇到的在页面中点击链接或按钮打开新页面的JS,在此进行收集: 1:以对话框方式弹出新的页面,此种方式只能对对话框页面进行操作,即在未关闭该页面时无法对父页面进行操作: var ref = window.showModalDialog("xxx.do?aaa=1&bbb="+bbb,"","dialogHeight: 700px; dialogWidth: 1000px; edge: Raised;center: Yes; help: Yes; resizable: NO; status: Yes;Maximize:NO;"); if(ref==true)\{ //ref 对象表示子页面返回给父页面的值( 在子页面window.close();之前,window.returnValue=true ;将boolean值返回给父页面) window.location.href = window.location.href ;//刷新当前页面,模式窗口(showModalDialog和showModelessDialog)时,不能使用location.reload()刷新当前页面,原因可参考http://bbs.csdn.net/topics/190061940,他们的区别。 \} 2:javascript:popWindow打开新页面,新页面会完全覆盖父页面,子父页面未做限制 <a href="javascript:popWindow('xxx.jsp?iid=11');">查看模板</a> 3:window.open打开新页面,可参考http://blog.csdn.net/business122/article/details/8281142 var ref = window.open("xxx.do?islook=no&id="+id); if(ref == true)\{ window.location.href = window.location.href ;//刷新问题同第二点 \}
还没有评论,来说两句吧...