日期:2014-05-16  浏览次数:20376 次

为什么这段js在本地正常,发布都服务器上就出错了呢!求解
代码 如下:
JScript code

 <script language="javascript">
        var getFromParent = window.dialogArguments;
        function CheckSelect() {
            var aaaa = "";
            for (var i = 0; i < window.document.formfoo.elements.length; i++) {
                var e = this.formfoo.elements[i];
                if (e.checked) {
                    if (aaaa == "") {
                        aaaa = e.value;
                    }
                    else {
                        aaaa = aaaa + "," + e.value;
                    }
                }
            }
            return aaaa;
        }

        function sendFromChild() {
            window.returnValue = CheckSelect();
            window.close();
        }

        function CCC() {
            window.returnValue = "";
            window.close();
        } 
    </script>



放到服务器上会出现window.document.formfoo 为空 或不是对象 的错误,这个页面是弹出层,弹出这个网页的那种弹出层

整个页面代码如下
HTML code

<html>
<head>
    <title>选择条件</title>
    <meta http-equiv="Content-Language" content="zh-cn">
    <link href="../Style/Style.css" type="text/css" rel="STYLESHEET">
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <base target="_self" />
    <script language="javascript">
        var getFromParent = window.dialogArguments;
        function CheckSelect() {
            var aaaa = "";
            for (var i = 0; i < window.document.formfoo.elements.length; i++) {
                var e = this.formfoo.elements[i];
                if (e.checked) {
                    if (aaaa == "") {
                        aaaa = e.value;
                    }
                    else {
                        aaaa = aaaa + "," + e.value;
                    }
                }
            }
            return aaaa;
        }

        function sendFromChild() {
            window.returnValue = CheckSelect();
            window.close();
        }

        function CCC() {
            window.returnValue = "";
            window.close();
        } 
    </script>
</head>
<body scroll="no">
    <form id="formfoo" method="post" runat="server">
    <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" bordercolorlight="#c0c0c0"
        bordercolordark="#ffffff">
        <tr>
            <td height="22" background="../images/show_02.gif" align="left" style="font-size: 12px;
                font-family: 宋体">
                请选择您需要的项,然后点“确定”!
            </td>
        </tr>
        <tr>
            <td valign="top" style="text-align: center">
                查询:<asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="100px"></asp:TextBox><asp:ImageButton
                    ID="ImageButton4" runat="server" ImageAlign="AbsMiddle" ImageUrl="../images/Button/BtnSerch.jpg"
                    OnClick="ImageButton4_Click"