解决window.showModalDialog在Firefox无法支持
<script language="javascript">
function colorpick(obj){
if (window.showModalDialog!=null)//IE判断
{
var smd= window.showModalDialog("Default2.aspx","","dialogWidth:225px;dialogHeight:170px;status:no;help:no;scrolling=no;scrollbars=no");
if(smd!=null)
obj.style.background=rtn;
return;
}
else
{
this.returnAction=function(strResult){
if(strResult!=null)
obj.style.background=strResult;
}
window.open("Default2.aspx","","width=225,height=170,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes");
return;
}
}
</script>
function colorpick(obj){
if (window.showModalDialog!=null)//IE判断
{
var smd= window.showModalDialog("Default2.aspx","","dialogWidth:225px;dialogHeight:170px;status:no;help:no;scrolling=no;scrollbars=no");
if(smd!=null)
obj.style.background=rtn;
return;
}
else
{
this.returnAction=function(strResult){
if(strResult!=null)
obj.style.background=strResult;
}
window.open("Default2.aspx","","width=225,height=170,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes");
return;
}
}
</script>
在一个父窗口中打开一个子窗口,并把子窗口的值传递给父窗口
在父窗口中:
function act(RGB) {
if (window.showModalDialog!=null)//IE判断
{
parent.window.returnValue="#"+RGB;
window.close();//firefox不支持
}
else
{
window.opener.returnAction("#"+RGB);
top.close();//IE和FireFox都支持
}
}
if (window.showModalDialog!=null)//IE判断
{
parent.window.returnValue="#"+RGB;
window.close();//firefox不支持
}
else
{
window.opener.returnAction("#"+RGB);
top.close();//IE和FireFox都支持
}
}