js 全選

來源:互聯網
上載者:User

標籤:style   blog   color   io   os   ar   java   for   sp   

 1 <script type="text/javascript"> 2     function checkAll(name) { 3         var el = document.getElementsByTagName(‘input‘); 4         var len = el.length; 5         for (var i = 0; i < len; i++) { 6             if ((el[i].type == "checkbox") && (el[i].name == name)) { 7                 el[i].checked = true; 8             } 9         }10     }11     function clearAll(name) {12         var el = document.getElementsByTagName(‘input‘);13         var len = el.length;14         for (var i = 0; i < len; i++) {15             if ((el[i].type == "checkbox") && (el[i].name == name)) {16                 el[i].checked = false;17             }18         }19     }20 </script>

 

 

1     <form action="result.jsp">2         <input type="checkbox" name="test1" value=""3             onclick="if(this.checked==true) { checkAll(‘test‘); } else { clearAll(‘test‘); }" />4         字母全選開關 <input type="checkbox" name="test" value="a" /> a <input5             type="checkbox" name="test" value="b" /> b <input type="checkbox"6             name="test" value="c" /> c <input type="checkbox" name="test"7             value="d" /> d <input type="submit" value="submit" />8     </form>

 

1 <%2         String list[] = request.getParameterValues("test");3     for(String s:list){4     %>5     <%=s %>6     <%} %>

 

js 全選

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.