簡體   English   中英

第二選擇選項沒有價值

[英]Second Select option didn't get value

請選中我的第二個選擇框獲取值,但不要從第一個選擇框獲取值。 請檢查我的代碼我錯了嗎?

這是我的代碼:

          <select class='form-control' id=class_code name=class_code 
          onchange='setTextField(this)'><option value=''>Select 
          class</option>";
         <option value=$row[class_code] >$row[class]</option>";
             }
        </select>
        <input id='cls' type = 'hidden' name = 'cls' value = '' />
           <script type='text/javascript'>
          function setTextField(dddl) {
               document.getElementById('cls').value = 
            dddl.options[dddl.selectedIndex].text;
               }
            </script>

            <select class='form-control' id=semester_id name=semester_id     
            onchange='setTextField(this)'><option value=''>Select 
             semester</option></select>
            <input id='semm' type = 'hidden' name = 'semm' value = '' />
           <script type='text/javascript'>
          function setTextField(ddl) {
              document.getElementById('semm').value = 
              ddl.options[ddl.selectedIndex].text;
                }
           </script>

請檢查我錯了。 提前致謝 :)

<select class='form-control' id=class_code name=class_code onchange='setTextField1(this)'>
    <option value=''>Select class</option>";
    <option value=$row[class_code]>$row[class]</option>";
</select>
<input id='cls' type = 'hidden' name = 'cls' value = '' />
<script type='text/javascript'>
    function setTextField1(dddl) {
        document.getElementById('cls').value = dddl.options[dddl.selectedIndex].text;
    }   
</script>

<select class='form-control' id=semester_id name=semester_id onchange='setTextField(this)'>
    <option value=''>Select semester</option>
    <option value='1'>semester1</option>
</select>
<input id='semm' type = 'hidden' name = 'semm' value = '' />
<script type='text/javascript'>
    function setTextField(ddl) {
          document.getElementById('semm').value = ddl.options[ddl.selectedIndex].text;
    }
</script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM