document.getElementById("ListBox1").options[i]=new Option(document.getElementById("ListBox2").options[j].text.trim(),document.getElementById("ListBox2").options[j].value.trim());
总说这句话不支持此属性和方法,我在前面引用了一个梅花雨日历控件
<script language="javascript" src="script/Calendar.js"  charset="gb2312"></script> 
把这句话给删了不要引用就出现那个错误,加上这句话就可以执行,真不知道其中奇怪的地方,这两个东西好像没联系啊,请教

解决方案 »

  1.   

    没看出问题,
    贴前台代码看看
    没少<script>标记吧?
      

  2.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="zj_select.aspx.cs" Inherits="zj_select" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>项目入库</title>
        <link href="css/search.css" rel="stylesheet" type="text/css">
        <script language="javascript" src="script/Calendar.js"  charset="gb2312"></script> 
        <script language="javascript" type="text/javascript">
        
        function showzj_leave()
        {
         __doPostBack('TextBox_major1_TextChanged',''); }
        function openmajor() 
        {
        window.open("hy_select.aspx","主评专业", "height=420, width=380, top=120, left=300, toolbar=no, menubar=no, scrollbars=auto,resizable=no,location=no, status=no") ;
       
        }
        function checkthis()
        {
          if(parseInt(document.getElementById("num_selected").value)>parseInt(document.getElementById("num_zjleave").innerText))
          {alert("抽取专家数大于可抽取的专家数!请重新填写!");
          document.getElementById("num_selected").value="";
          document.getElementById("num_selected").focus();}
        }
        function selectzj()
        {
        var length=document.getElementById("ListBox2").options.length;
        var x=parseInt(document.getElementById("num_selected").value);
        var list2=document.getElementById("listbox2");
            for (var i=0;i<x;i++)
            { 
             var j=  parseInt(Math.random()*(length-i));         
             document.getElementById("ListBox1").options[i]=new Option(document.getElementById("ListBox2").options[j].text.trim(),document.getElementById("ListBox2").options[j].value.trim());
         document.getElementById("ListBox2").remove(j);        }
           document.getElementById("selected").disabled=true;
        
          }
           
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <table align="center" border="1px" bordercolor="blue" width="80%">
        <tr>
        <td width="20%">
        项目编号:
        </td>
        <td colspan="4">
          <asp:TextBox ID="TextBox_code" runat="server"></asp:TextBox>
        </td>
        </tr>
        <tr>
        <td width="20%">
        项目名称:
        </td>
        <td colspan="4">
            <asp:TextBox ID="TextBox_name" runat="server"></asp:TextBox>
        </td>
        </tr>
            <tr>
        <td>
            项目简介:
        </td>
        <td colspan="4">
        <asp:TextBox ID="TextBox_content" runat="server" TextMode="MultiLine" Width="325px"></asp:TextBox>
        </td>
        </tr>
        <tr>
        <td>
            所属行业:</td>
        <td colspan="4">
    <asp:TextBox ID="TextBox_major1" runat="server" Width="200px" OnTextChanged="TextBox_major1_TextChanged" AutoPostBack="True" ></asp:TextBox><br />
                        <asp:HiddenField ID="TextBox_major" runat="server" />  
                       </tr>
            <tr>
        <td>
        评标时间:
        </td>
        <td align="center">
            从</td>
        <td>
            <asp:TextBox ID="TextBox_from" runat="server" Width="122px" ReadOnly="true"></asp:TextBox></td>
        <td align="center">
            到</td>
        <td>
            <asp:TextBox ID="TextBox_to" runat="server" Width="121px" ReadOnly="true"></asp:TextBox></td>
        </tr>
        <tr>
        <td colspan="2">
        可以参加评标专家人数:
        </td>
        <td>
            <asp:Label ID="num_zjleave" runat="server" Text=""></asp:Label>
        </td>
        <td>
        抽取几位专家:</td>
        <td>
            <asp:TextBox ID="num_selected" runat="server" Width="120px"></asp:TextBox></td>
        </tr>
            <tr>
        <td>
            抽取专家:</td>
        <td colspan="4">
            <input id="selected" type="button" value="抽取专家"  onclick="selectzj()"/>      
            <font color="red">* 只能抽取一次!</font>
            </td>
        </tr>
        </table>
        <table align="center" border="1px" bordercolor="blue" width="80%">
        <tr>
        <td width="20%">
        抽取专家:
        </td>
        <td>
            <asp:ListBox ID="ListBox1" runat="server" Width="134px"></asp:ListBox>
            <asp:ListBox ID="ListBox2" runat="server" style="display:none" Width="118px"></asp:ListBox></td>
        </tr>
        <tr>
        <td colspan="2" align="center">
            <asp:Button ID="Btn_up" runat="server" Text="提交" OnClick="Btn_up_Click" />
        </td>
        </tr>
        
        </table>
        
        </div>
        </form>
    </body>
    </html>
    黑体部分只要把script/Calendar.js改成calendar1.js(注:这两个js都是我从网上下的)时就可以执行没有错误,我把这句话给删了,不要日历控件同样有错误,不支持此属性或方法,我想知道给listbox添加值的方法对不对