你用onchange时间判断,多加个文本框的层算了

解决方案 »

  1.   

    <html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 2</title>
    <script>
    function ttt(){
    var i=0; 
     for(i=0;i<document.all.sele1.length;i++){ 
    if(document.all.sele1[i].selected==true)
    { alert(i);
    }
    }
    }
    </script>
    </head><body>
    <select id="sele1" onchange="ttt()">
    <option value="1">ttt</option>
    <option value="2">bbb</option>
    </select>
    </body></html>
      

  2.   

    呵呵,本来还有
    var o = document.getElementById("table1");
    var trnew = o.insertRow;
    var tdnew=trnew.inserCell;
    tdnew.innerHTML="<input type='text' id=''>"
      

  3.   

    <script>
    if (document.form1.1.selected)
    {
       document.form1.yintan.type=text
    }
    else
    {
       document.form1.yintan.type=hidden  
    }
    </script>
    <form name="form1" method="post" action="">
      <select name="select">
        <option selected id="1">a</option>
        <option id="2">b</option>
      </select>
      <input type="text" name="textfield">
      <input type="hidden" name="hiddenField">
    </form>