Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对话框窗口上的表单提交在IE中打开一个空白页_Javascript_Html_Internet Explorer_Jsp - Fatal编程技术网

Javascript 对话框窗口上的表单提交在IE中打开一个空白页

Javascript 对话框窗口上的表单提交在IE中打开一个空白页,javascript,html,internet-explorer,jsp,Javascript,Html,Internet Explorer,Jsp,我到处寻找类似的问题,但不幸的是,似乎没有一个对我很有效。 我有一个对话框窗体,在父文档中单击打开。编辑完这些值后,表单被提交到Javaservlet,关闭对话框并返回到父级。在Chrome或Firefox中,一切正常,但在IE中,它会打开一个带有响应URL的空白页面。 解决方案应该非常有用,但任何指针都应该是好的 父JSP: <body class="yui3-skin-sam"> <center> <div id="ok">

我到处寻找类似的问题,但不幸的是,似乎没有一个对我很有效。 我有一个对话框窗体,在父文档中单击打开。编辑完这些值后,表单被提交到Javaservlet,关闭对话框并返回到父级。在Chrome或Firefox中,一切正常,但在IE中,它会打开一个带有响应URL的空白页面。 解决方案应该非常有用,但任何指针都应该是好的

父JSP:

<body class="yui3-skin-sam">
    <center>
        <div id="ok">
        <h1>NBReports</h1>
        <p>New business on call reports</p><br/>        
        <input type="button" value="Add Row" align="right" onclick="javascript: showWindow(window, 1)" /><br/>      
        <div id="tblReportSchedule"></div><br/>
        <input type="button" value="Add Row" align="right" onclick="javascript: showWindow(window, 1)" />
        </div>
    </center>
</body>
<script type="text/javascript">

function showWindow(obj, bEdit)
{   
    if(bEdit == 1)
        {
            openModal("updateSchedule.jsp", 600, 450);
        }
    else if(bEdit == 2)
        {   
            var rowID = obj.parentNode.parentNode.parentNode.parentNode.id; 
            openModal("updateSchedule.jsp", 600, 450, getAllRowValuesbyID(rowID));
        }
    else 
        {
            var rowID = obj.parentNode.parentNode.parentNode.parentNode.id; 
            openModal("updateSchedule.jsp", 300, 200, getAllRowValuesbyID(rowID).split("/")[0]);            
        }
}

function getAllRowValuesbyID(rowID)
{
    var rowValues="";
    row = document.getElementById(rowID);

    for (var i = 0; i < row.childNodes.length; i++) {
        if((window.navigator.userAgent.toLowerCase().indexOf('windows') == -1) )
        {
            var node = row.childNodes[i];
            rowValues += node.textContent + "/";
        }
        else
        {
            var node = row.children[i];
            rowValues += node.outerText + "/";  
        }
    }
    return rowValues;
}

function openModal(url, width, height, rowValues)
{
    var features = "";
    if (width != "")
    {
    features = features + "dialogWidth:" + width + "px;";
    }
    if (height != "")
    {
        features = features + "dialogHeight:" + height + "px;";
    }

    var retVal = window.showModalDialog(url, rowValues, features);  

    if(retVal)
    {
        document.location.reload(true);
    }
}

</script>

</html>

NBR报告
新业务待命报告




功能显示窗口(obj、bEdit) { 如果(bEdit==1) { OpenModel(“updateSchedule.jsp”,600450); } else如果(bEdit==2) { var rowID=obj.parentNode.parentNode.parentNode.parentNode.id; OpenModel(“updateSchedule.jsp”,600450,getAllRowValuesbyID(rowID)); } 其他的 { var rowID=obj.parentNode.parentNode.parentNode.parentNode.id; OpenModel(“updateSchedule.jsp”,300200,getAllRowValuesbyID(rowID).split(“/”[0]); } } 函数getAllRowValuesbyID(rowID) { var值=”; row=document.getElementById(rowID); 对于(var i=0;i
对话框窗体:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Update Schedule Form</title>

<script type="text/javascript">
    function onSubmit()
    {
        window.returnValue = "";
        if((window.opType == 3) || window.dirtyFlag)
        {   
            window.dirtyFlag = 1;
            window.returnValue = getValue('cronTab') + '/' + 
                                 getValue('reportName') + '/' +
                                 getValue('subject') + '/' +
                                 getValue('recipient') + '/' +
                                 getValue('cc') + '/' +
                                 getValue('database') + '/' +
                                 getValue('script') + '/' +
                                 getValue('format');
        }
        window.close();
    }

    function getValue(varName)
    {
        if(document.getElementById(varName) == null)
            return "";
        if(document.getElementById(varName).value == null)
            return "";
        else
            return document.getElementById(varName).value;
    }

    function setdirtybit()
    {
        window.dirtyFlag = 1;
    } 

    function SubmitForm()
    {
        if(window.navigator.userAgent.toLowerCase().indexOf('chrome') == -1)
        {
            if(window.dirtyFlag || window.opType == 3)
            {
                document.forms["UpdateSchedule"].method="get";
                document.forms["UpdateSchedule"].action="/nbreports/updates";
                document.forms["UpdateSchedule"].target="_self";
                document.forms["UpdateSchedule"].submit();
            }
        }
    }

    function GenerateSubmit(valText)
    {
        var submitButton = "";
        if(window.navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
            submitButton = "<center><input type ='submit' value='" + valText + "' onclick='onSubmit()' /></center>";            
        else
            submitButton = "<center><input type ='button' value='" + valText + "' onclick='onSubmit()' /></center>";

        return submitButton;
    }   

    window.onbeforeunload = SubmitForm;
    </script>
</head>
<body>  
    <form name="UpdateSchedule" id = "UpdateSchedule" action="/nbreports/updates" method="get">
        <script type="text/javascript">
        var valuesArray = new Array();
        if(typeof window.dialogArguments == "undefined")
        {
            var idArray=["cronTab","reportName","subject","recipient","cc","database","script","format"];
            var nameArray=["CronTab","Report Name","Message Subject","Recipient List","Cc","Database","Script","Format"];

            var str = "<table cellpadding = '2' border = '0'>";

            for(var i = 0; i < 8; i++){
                str += "<tr>";
                str += "<td><label for='" + nameArray[i]+"'>" + nameArray[i] + "</label></td>"; 
                if(i==3 || i==4){
                    str += "<td><input style='width:450px' type ='text' id='" + idArray[i] + "' name='" + nameArray[i] + "' onchange='setdirtybit()' /></td>";
                }
                else{str += "<td><input style='width:200px' type ='text' id='" + idArray[i] + "' name='" + nameArray[i] + "' onchange='setdirtybit()' /></td>";}
                str += "</tr>";
            }
            str += "<tr style='display: none;'><input type='hidden' name='opType' value='1' /></tr>";
            str += "</table>";

            document.write(str);        
            document.write(GenerateSubmit("Submit"));   
        }
        else 
        {
            valuesArray=window.dialogArguments.split("/");
            if(valuesArray.length == 1)
            {
                document.write("<center><label>Are you sure you want to delete the row?</label><br/><br/></center>");
                document.write("<input type='hidden' name='id' value='"+ valuesArray[0] +"' />");
                document.write("<input type='hidden' name='opType' value='3' />");
                document.write(GenerateSubmit("Ok"));
                window.opType = 3;
            }
            else
            {       
                var idArray=["cronTab","reportName","subject","recipient","cc","database","script","format","id"];
                var nameArray=["CronTab","Report Name","Message Subject","Recipient List","Cc","Database","Script","Format", "Id"];

                var str = "<table cellpadding = \"2\" border = \"0\">";

                for(var i = 0; i < 8; i++){
                    str += "<tr>";
                    str += "<td><label for='" + nameArray[i]+"'>" + nameArray[i] + "</label></td>"; 
                    if(i==3 || i==4){
                        str += "<td><input style='width:450px' type ='text' id='" + idArray[i] + "' name='" + nameArray[i] + "' onchange='setdirtybit()' /></td>";
                    }
                    else{str += "<td><input style='width:200px' type ='text' id='" + idArray[i] + "' name='" + nameArray[i] + "' onchange='setdirtybit()' /></td>";}
                    str += "</tr>";
                }
                str += "<tr style='display: none;'><input  type ='hidden' name='id' value='"+ valuesArray[0] +"'/></tr>";
                str += "<tr style='display: none;'><input  type ='hidden' name='opType' value='2' /></tr>";
                str += "</table>";

                document.write(str);
                for(var i = 0; i < 8; i++){
                    document.forms[0].elements[nameArray[i]].value = valuesArray[i+1];
                }
                document.write(GenerateSubmit("Submit"));
            }
        }               
        </script>
    </form>
</body>

</html>

更新时间表表格
函数onSubmit()
{
window.returnValue=“”;
if((window.opType==3)| | window.dirtyFlag)
{   
window.dirtyFlag=1;
window.returnValue=getValue('cronTab')+'/'+
getValue('reportName')+'/'+
getValue('subject')+'/'+
getValue('recipient')+'/'+
getValue('cc')+'/'+
getValue('database')+'/'+
getValue('script')+'/'+
getValue('format');
}
window.close();
}
函数getValue(varName)
{
if(document.getElementById(varName)==null)
返回“”;
if(document.getElementById(varName).value==null)
返回“”;
其他的
return document.getElementById(varName).value;
}
函数setdirtybit()
{
window.dirtyFlag=1;
} 
函数SubmitForm()
{
if(window.navigator.userAgent.toLowerCase().indexOf('chrome')=-1)
{
if(window.dirtyFlag | | window.opType==3)
{
document.forms[“UpdateSchedule”].method=“get”;
document.forms[“UpdateSchedule”].action=“/nbreports/updates”;
document.forms[“UpdateSchedule”]。target=“_self”;
document.forms[“UpdateSchedule”].submit();
}
}
}
函数GenerateSubmit(valText)
{
var submitButton=“”;
if(window.navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
submitButton=“”;
其他的
submitButton=“”;
返回提交按钮;
}   
window.onbeforeunload=提交表单;
var valuesArray=新数组();
if(typeof window.dialogArguments==“未定义”)
{
var idArray=[“cronTab”、“reportName”、“subject”、“recipient”、“cc”、“database”、“script”、“format”];
var nameArray=[“CronTab”、“报告名”、“消息主题”、“收件人列表”、“抄送”、“数据库”、“脚本”、“格式”];
var str=“”;
对于(变量i=0;i<8;i++){
str+=”;
str+=“”+nameArray[i]+“”;
如果(i==3 | | i==4){
str+=”;
}
else{str+=“”;}
str+=”;
}
str+=”;
str+=”;
文件编写(str);
文件。编写(生成提交(“提交”);
}
其他的
{
valuesArray=window.dialogArguments.split(“/”);
如果(值ray.length==1)
{
document.write(“是否确实要删除该行?

”); 文件。填写(“”); 文件。填写(“”); 编写(生成提交(“确定”); window.opType=3; } 其他的 { var idArray=[“cronTab”、“reportName”、“subject”、“recipient”、“cc”、“database”、“script”、“format”、“id”]; var nameArray=[“CronTab”、“报告名”、“消息主题”、“收件人列表”、“抄送”、“数据库”、“脚本”、“格式”、“Id”]; var str=“”; 对于(变量i=0;i<8;i++){ str+=”; str+=“”+nameArray[i]+“”; 如果(i==3 | | i==4){ str+=”; } else{str+=“”;} str+=”; } str+=”; str+=”; str+=”; 文件编写(str); 为了(