关于模态窗口window.showModalDialog
来源:互联网 发布:贵金属数据下载 编辑:程序博客网 时间:2024/06/05 14:13
现在做的项目中后台文章有添加附件的功能,用的是js在当前窗口前弹出一个小的模态窗口,从而添加附件。
今天遇到一个在火狐下弹出模态窗口会有错误,因为模态窗口中要加载的页面在根目录下,在ie 谷歌等浏览器中会识别
"\\a.aspx"这种写法定位到根目录,火狐下不会识别,而会在当前窗口路径后直接查找“\\a.aspx”,所以会有错。
现在找到一种解决办法,在火狐下来代替 window.showModalDialog(sURL [, vArguments] [, sFeatures]) ;
范例:
window.showModalDialog("openwin.html","Arguments","dialogHeight: 200px; dialogWidth: 200px; dialogTop: 10px; dialogLeft: 10px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
但是.在Firefox中却没有showModalDialog这东西,
而在FireFox中我们只能使用window.open实现这样的功能,
window.open的语法如下 :
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])
只是,在Firefox下,window.open的参数中,sFeature多了一些功能设定,
而在FireFox下要让开启的窗口跟IE的showModalDialog一样的话,
只要在sFeatures中加个modal=yes就可以了,
范例如下:
window.open('openwin.html','newWin','modal=yes,width=200,height=200,resizable=no,scrollbars=no');
下面是我的修改方案;
先判断浏览器是否是火狐,如果是就用window.open()方法,如果不是还继续用window.showModalDialog()方法
if ($.browser.mozilla) { ReturnStr = window.open("/PClass/app/UpLoad/upload.aspx?rnd=" + number + "&upFileStr=" + upFileStr + "&upPathStr=" + upPathStr + "&FileSizeStr=" + FileSizeStr + "&ModuleID=" + ModuleID + "&FileDes=" + FileDes + "", this, "modal=yes,width=400px,height=440px,resizable=no,scrollbars=no,Top=200px, edge=Raised, center= Yes, help= no,scroll= yes, status= no"); } else { //火狐下获取该路径 错误 ,不会返回到根目录获取。 ReturnStr = window.showModalDialog("\\PClass\\app\\UpLoad\\upload.aspx?rnd=" + number + "&upFileStr=" + upFileStr + "&upPathStr=" + upPathStr + "&FileSizeStr=" + FileSizeStr + "&ModuleID=" + ModuleID + "&FileDes=" + FileDes + "", this, "dialogHeight:300px; dialogWidth:440px; dialogTop: 200px; edge: Raised; center: Yes; help: no;scroll: yes; resizable: no; status: no;");}
欢迎加入.net技术交流群
- 关于模态窗口window.showModalDialog
- 关于模态窗口window.showModalDialog
- 关于模态窗口window.showModalDialog
- 模态窗口window.showModalDialog
- 模态窗口window.showModalDialog
- web模态窗口window.showModalDialog简介
- window.showModalDialog(模态对话窗口)
- Web模态窗口window.showModalDialog简介
- web模态窗口window.showModalDialog简介
- window.showModalDialog模态窗口参数说明
- 模态窗口小例子window.showModalDialog
- 关于模态窗口(showModalDialog)的专题!
- 关于模态窗口(showModalDialog)----asp.net
- 关于模态窗口(showModalDialog)的专题讨论!
- 关于模态窗口(showModalDialog)的专题讨论
- 关于模态窗口(showModalDialog)的专题
- window.showModalDialog打开模态窗口父子页面间对话
- window.showModalDialog打开模态窗口父子页面间对话 .
- cocos2dx 3.0 js继承:John Resiq的继承写法解析
- QTP/UFT中定位对象的最常见方法
- Hive:用Java代码通过JDBC连接Hiveserver
- 63-输入一个数字,判断是不是回文数字
- spring mvc i18n+freemarker
- 关于模态窗口window.showModalDialog
- iOS inputView 和 inputAccessoryView
- Redis命令zrange,zrangebyscore,zrevrank,zremrangebyscore
- sublime text编译时提示错误[Decode error - output not utf-8] compilation terminated
- [Oracle] 性能调优实例 - read by other session
- MyBatis详解 与配置MyBatis+Spring+MySql
- shell编程笔记-流编辑Sed
- canny边缘检测
- 利用John和L0phtCrack批量破解htpasswd