JS implementation of the verification, learning to use JS control td_javascript Skills

Source: Internet
Author: User
<ptml> <pead> <title>js Cumulative 001-rows and cells use </title> <scrip T type= "Text/javascript" > Function ValidForm (curform, bodyname) {var bodyobj = do Cument.getelementbyid (Bodyname); var rowobj = null; var cellobj = null; if (bodyobj = = null) {return false; //reference rows for (var i = 0; i < bodyObj.rows.length i + +) {rowobj = bodyobj.rows[i]; with * must input, reference cells if (Rowobj.cells[0].innertext.indexof ("*") > 0) { if (Rowobj.cells[1].childnodes[0].value = = "") {alert (Rowobj.cells[0].innertext.replac E ("*:", "") + "cannot be empty!" "); return false; } alert ("Pass Validation"); Curform.submit (); } </script> </pead> <body> <form action= "method=" post "Name=" Loginf RM "> <table> <tbody id=" Validbody "> <tr> <t D align= "right" > Username <font color= "Red" >*</font>:</td> <td><input type= "text" n Ame= "username"/></td> </tr> <tr> <td align= "right" > Secret Code <font color= "Red" >*</font>:</td> <td><input type= "password" name= "username"/& gt;</td> </tr> <tr> <td align= "right" > Subsystem <font Color = "Red" >*</font>: </td> <td> <select name= "SystemName" > <option value= "" >---Please select ---</option> <option value= "hr" > HR system </option> <option value= "PUR" > Procurement System </option> <option value= "SAL" > Sales system </option> </select> </td> </tr> </tbody> <tbody> <tr&gt ; &LT;TD colspan= "2" > <input type= "button" value= "submitted" name= "Submit" onclick= "ValidForm (this. form, ' validbody ') "/> <input type=" reset "value=" reset "name=" reset "/> </td> </tr> </tbody> </table> </for M> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.