这段代码为什么火狐和一些浏览器都弹不出上传框,低版本的IE可以
<script language="javascript">
$(document).ready(function(){
$("div.hastabmenu ul.tabmenu li").click(function(){
var tabdiv = $(this).parent().parent();
var tabul = $(this).parent();
var i = tabul.children().index(this);
tabul.children().removeClass('tabcurrent')
tabul.children().eq(i).addClass('tabcurrent')
tabdiv.children('div').hide()
tabdiv.children('div').eq(i).show();
});
$("img.chooseimg").click(function(){
var curdir = $(this).attr('curdir')==undefined?'':$(this).attr('curdir');
var fileExt = $(this).attr('fileExt')==undefined?'':$(this).attr('fileExt');
var sPhoto=window.showModalDialog('admin.php?ac=uploadfile&op=iframe&curdir='+curdir+'&fileExt='+fileExt,"keys","help:no;status:no;scroll:no;");
if ((sPhoto!=null) && (sPhoto!="http://") && (sPhoto!="")){
$(this).prev().val(sPhoto);
$(this).prev().focus();
}
});
$("input.choosetmp").click(function(){
var sPhoto=window.showModalDialog('admin.php?ac=choosetmp&op=iframe',"keys","help:no;status:no;scroll:no;");
if ((sPhoto!=null) && (sPhoto!="http://") && (sPhoto!="")){
$(this).prev().val(sPhoto);
}
});
$("input.curdateBtn").click(function(){
$(this).prev().val($(this).attr('time'));
});
});
</script>
应该怎么改才能兼容所有浏览器,麻烦知道的大哥直接给个代码,谢谢了

解决方案 »

  1.   

    showModalDialog有些低版本非ie的浏览器不支持的,要自己修改成成window.open形式,但是不能挂起返回值你要全部兼容只能改为层的形式来调用,逻辑要全部改过Web开发学习资料推荐
    jqGrid一些疑难问题和解决方案
    jqGrid事件
      

  2.   

    window.showModalDialog() 在非ie浏览器中没有模态对话框的“模态”特性,不会挂起后面的程序,相当于window.open()你可以改用window.open() 或者div层模拟对话框
      

  3.   

    chrome已经不支持showModalDialog了,建议不要用了
    现在很多模态对话框组件,很好的