<select name="cCode" onchange="fquery.submit();">
<option></option>
<option value = "AN323"> 111</option >
<option value = "AN32311"> 222</option >
</select>

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta http-equiv="Expires" content="0">
    <link HREF="../css/styles.css" REL="STYLESHEET" TYPE="text/css">
    <title>test</title>
    <script language="JavaScript">
    <!--
    function su()
    {
    fquery.action = "test.asp?tmp=" + fquery.cCode.options[fquery.cCode.selectedIndex].value;
    fquery.submit();
    }
    //-->
    </script>
    </head>
    <body>
    <form name=fquery method=post action="Page">
    <input type=hidden name="search" value=Y>
    <div align="center"><center><table border="0" cellspacing='1' cellpadding='0' class="DTab">
    <tr><th class="DTh">
    test
    <select name="cCode" onchange="su()">
    <option></option>
    <option value = "AN323"> 111</option >
    <option value = "AN32311"> 222</option >
    </select>
    </th></tr>
    </table></center></div>
    </form>
    </body>
    </html>
      

  2.   

    谢谢楼上两位的指点,我想知道的是为什么javascript不能写在外面,不能这样写
    <script>
    fquery.cCode.onchange=fquery.submit;
    </script>
    那如果是写在js文件里,要在这里引入怎么办?
      

  3.   

    <form name="frm" method="post" action="">
      <select name="select" onChange="this.form.aaa.value=this.value;">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
      </select>
      <br>
      <br>
      <input type="text" name="aaa">
    </form>
      

  4.   

    我知道可以直接写在select的后面,我想知道的是为什么javascript不能写在外面。
    那如果是写在js文件里,要在这里引入怎么办?
      

  5.   

    你要在外面取得select的参数,必须用循环,如同下面这个radiofunction GetRadioValue(radName){
    var radGroup=document.all(radName);
    for(var iCnt=0;iCnt<radGroup.length;iCnt++)
    if(radGroup[iCnt].checked) return radGroup[iCnt].value;
    }
      

  6.   

    <select onchange="SelectedChange(this)" >...<script language="javascript">
    function SelectedChange(selecter)
    {
       alert(selecter.options[selecter.selectedIndex].value);// use this to get Selected Value
       // add your code to refresh page here.
    }
    </script>=-------------------
    hope this would be helpful.
    ^_^