您的位置:首页 > 其它

ucUncaught TypeError: window.showModalDialog is not a function关于showModalDialog停用的问题

2017-10-26 19:01 585 查看

ucUncaught TypeError: window.showModalDialog is not a function关于showModalDialog停用的问题

function openWin(f, n, w, h, s)
{
//测试值得传入
alert("测试"+f+" "+n+" "+w+" "+h+" "+s);
// var result=window.showModalDialog(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);
var result=window.open(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);
if(result==true)
{
window.location.reload(true);
}
else
{
//window.location.reload(true);
}

}在前台中
var result=window.showModalDialog(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);




后台的值也传进来了,为什么会出现window.showModalDialog is not a function  

一个onclick一直无响应,后台的数据发现也传过去了,在前台出现这个window.showModalDialog is not a function,

不可能啊,怎么没发现呢,函数也没写错啊,结果查了查,原来在chorme 37以后,谷歌就已经把这个函数停用了,

把停用的showModalDialog改成window.open就可以打开子窗体了,应该说好多旧方法都在摒弃。。。

如果发发现js有不对的地方,打开浏览器多多按F10,进行js调试跟踪。




改成open就可以完美解决

function openWin(f, n, w, h, s)
{
//测试值得传入
alert("测试"+f+" "+n+" "+w+" "+h+" "+s);
// var result=window.showModalDialog(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);
var result=window.open(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);
if(result==true)
{
window.location.reload(true);
}
else
{
//window.location.reload(true);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: