说明一下,我的select实际是server端的dropdownlist控件,所以不要告诉我select内部套脚本混合编的方法。

解决方案 »

  1.   

    var ListBox = document.getElementById('...');
    for(i=0;i<ListBox.options.length;i++)
    {
    if(ListBox.options[i].innerText=参数值)
    ListBox.selectedIndex = i;
    }
      

  2.   

    如何在Dropdownlist的AutoPostback=false的情况下,即不回发。
    返回Dropdownlist的选定值。 DropDownList1.Attributes.Add("onchange", "alert(document.all('Dropdownlist1').value)")
      

  3.   

    for(i=0;i<document.all.ddlNo.options.length;i++)
    {
         if(document.all.ddlNo.options[i].value="fdafda")
                 ddlNo.selectedIndex = i;
    }
      

  4.   


    for(i=0;i<document.all.ddlNo.options.length;i++)
    {
         if(document.all.ddlNo.options[i].value="fdafda")
                 document.all.ddlNo.options[i].selected = true;
    }
      

  5.   

    liuyong_lll(孤醉) 的应该可以
    function ChooseWorker(){
    var argument,aa;
    argument="../basedata/dlg_worker.aspx"
    var retValue=window.showModalDialog("../basedata/dlgframe.htm",argument,"dialogWidth=300px;dialogHeight=400px;center=yes;status=no");
    if(retValue!=retValue)

      var obj1 =  document.getElementById("Orderdet1_d_workerid");      //这么写无效果
      for(i=0;i<obj1.options.length;i++)
      {
         if(obj1.options[i].value="retValue")
         {
                 obj1.selectedIndex = i;
         }
      } 
    }
      

  6.   

    <%@ Page Language="C#" AutoEventWireup="True" %>
    <html>
    <head>
       <script runat="server">
          void Button_Click(Object sender, EventArgs e) 
          {
             Label1.Text = "You selected: " + 
             Request.Form["dropdownlist1"].ToString() + ".";         
          }
       </script>
    </head>
    <body>
       <form runat="server">
          <h3>DropDownList Example</h3>
          Select an item from the list and click the submit button.
          <p>
          <asp:DropDownList id="dropdownlist1" runat="server">
             <asp:ListItem>Item 1</asp:ListItem>
             <asp:ListItem>Item 2</asp:ListItem>
             <asp:ListItem>Item 3</asp:ListItem>
             <asp:ListItem>Item 4</asp:ListItem>
          </asp:DropDownList>
          <br><br>
          <asp:Button id="Button1"  
               Text="Submit" 
               OnClick="Button_Click" 
               runat="server"/>
          <br><br>
          <asp:Label id="Label1" runat="server"/>
          <input id=x> <input type=button onclick="add()" value="添加">
       </form>
    </body>
    </html>
    <script>
    function add()
    {
    alert(document.getElementById("dropdownlist1").options[2].value)
    document.getElementById("dropdownlist1").options[2].value=document.getElementById("x").value
    document.getElementById("dropdownlist1").options[2].text=document.getElementById("x").value
    document.getElementById("dropdownlist1").options[2].selected = true
    }
    </script>
      

  7.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function AddValue()
    {
    for(var i=0;i<5;i++)
    {
    Select1.options[Select1.length] = new Option(i.toString(), "Text");
    }
    }
    //-->
    </SCRIPT>
    </HEAD><BODY>
    <SELECT id="Select1"></SELECT>
    <input type="button" value="添加值" onclick="AddValue()">
    </BODY>
    </HTML>
      

  8.   

    SORRY,是我的问题,form1写成了Form1
    等会结帖