showModalDialog的弹出问题 [英] popup issue for showModalDialog

查看:160
本文介绍了showModalDialog的弹出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景是我有一个父级和子页面。子页面包含所述国家/地区的列表。我在java脚本中使用了showModalDialog函数,它很容易返回我在子页面中选择的值。最近这个功能在chrome中不起作用,因为在新的更新中他们已经弃用了showModalDialog函数。请建议我做一些替代方案。

我尝试使用不同的方法,但我遇到的问题是有多个值从孩子返回我必须拆分并分配给我在父母的隐藏值:

这个是我的父代码:

函数Display_Session_Year(obj,obj_desc,Steps)
{
var retVal;
strPage =PopUpHelper.aspx?PageName = Pop_Commodity_warehouse_session.aspx& Steps =+ Steps;
DialogWidth =dialogWidth:500px; dialogHeight:550px; Center:yes; scroll:yes; resizable:no; status:no;;
retVal = window.showModalDialog(strPage,'',DialogWidth);
if(retVal!=&& retVal!= null)
{

var ArrValues = retVal.split(〜)


document.getElementById(obj).value = ArrValues [0];
document.getElementById(obj_desc).value = ArrValues [1];
document.getElementById('<% = txt_seasonyearDesc.ClientID %> ')。 value = ArrValues [3];
//document.getElementById(obj_desc).focus();
document.getElementById('<% = txt_seasonyearDesc.ClientID %> ')。焦点();
}
}





这是儿童用户代码:

 function Returnval(Val)
{
top.returnValue = Val
parent.window.close();
}

解决方案

尝试下列其中一项:

https://github.com/GoogleChrome/dialog-polyfill [ ^ ]

http://jqueryui.com/ dialog / [ ^ ]

< a href =http://getbootstrap.com/javascript/#modals> http://getbootstrap.com/javascript/#modals [ ^ ]


另见为什么不推荐使用window.showModalDialog?使用什么? [ ^ ]

你可以在这里得到答案

'window.ShowModalDialog'无法在Chrome中使用 [ ^ ]


Scenario is I have one parent and on child page. Child page contain list of say countries. I was using showModalDialog function in java script which is easily returned the value I had selected in my child page. Recently this functionality is not working in chrome as in new update they have deprecated showModalDialog function. Please suggest me some alternative to achieve this.
I tried same using different methods but issue I am facing is there are multiple values returning from child which I have to split and assign to my hidden values in parent:
This is my Parent code:

function Display_Session_Year(obj,obj_desc,Steps)
       {
           var retVal;
           strPage = "PopUpHelper.aspx?PageName=Pop_Commodity_warehouse_session.aspx&Steps=" + Steps;
           DialogWidth="dialogWidth:500px; dialogHeight:550px;Center:yes; scroll:yes ;resizable:no;status:no;";
           retVal=window.showModalDialog(strPage,'',DialogWidth);
           if(retVal!="" && retVal!=null)
           {

               var ArrValues=retVal.split("~")


               document.getElementById(obj).value = ArrValues [0];
               document.getElementById(obj_desc).value = ArrValues [1];
               document.getElementById('<%=txt_seasonyearDesc.ClientID%>').value = ArrValues [3];
            //document.getElementById(obj_desc).focus();
          document.getElementById('<%=txt_seasonyearDesc.ClientID%>').focus();
        }
    }



This is child page code:

function Returnval(Val)
        {
         top.returnValue= Val
        parent.window.close();
    }

解决方案

Try one of these:
https://github.com/GoogleChrome/dialog-polyfill[^]
http://jqueryui.com/dialog/[^]
http://getbootstrap.com/javascript/#modals[^]


Also see Why is window.showModalDialog deprecated? What to use instead?[^]


may be you can get the answer here
' window.ShowModalDialog ' not working in Chrome[^]


这篇关于showModalDialog的弹出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆