Two cases _javascript techniques of childnodes usage

Source: Internet
Author: User
First:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <TITLE> New Document &L t;/title> <meta name= "generator" content= "EditPlus" > <meta name= "Author" content= "" > <meta NAME= "Key Words "content=" "> <meta name=" Description "content=" "> <script language=" JavaScript "> <!--var row =-1; function Showedit (obj) {var cell2 = obj.parentnode.parentnode.childnodes[1]; var rowIndex = Obj.parentNode.parentNode.rowIndex; cell2.innerhtml = "<input type= ' text ' value= '" + cell2.innerhtml + "' >"; if (row!=-1) {var oldCell2 = document.getElementById ("TB"). Rows[row].cells[1]; oldcell2.innerhtml = Oldcell2.childnodes[0].value; row = RowIndex; //--> </SCRIPT> </HEAD> <BODY> <table id= "TB" > <TR> <td><input type= "Ra Dio "onclick=" Showedit (This) "Name=" Rad "></TD> <TD></TD> <TD></TD> </TR> < Tr> <td> <input type= "Radio" onclick= "Showedit (This)" Name= "Rad" ></TD> <TD></TD> <td></td > </TR> <TR> <td><input type= "Radio" onclick= "Showedit (This)" Name= "Rad" ></TD> <t d></td> <TD></TD> </TR> </TABLE> </BODY> </HTML>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Second:
<table border=1 width=100%> <tr> <td><input name=m type=checkbox onclick= "mm (this)" ></td& Gt <td>1111</td> <td><input name=aaa value= "222" disabled></td> <td><input name= BBB value= "333" disabled></td> </tr> <tr> <td><input name=m type=checkbox onclick= "mm" (th IS) "></td> <td>1111</td> <td><input name=aaa value=" 222 "Disabled></td> < Td><input name=bbb value= "333" disabled></td> </tr> <tr> <td><input name=m type=ch Eckbox onclick= "mm (this)" ></td> <td>1111</td> <td><input name=aaa value= "222" disabled ></td> <td><input name=bbb value= "333" disabled></td> </tr> </table> <scrip T language= "JavaScript" > function mm (e) {var currenttr=e.parentelement.parentelement; var inputobjs=currenttr.getelementsbytagname ("input"); for (Var i=0;i<inputobjs.length;i++) {if (inputobjs[i]==e) continue; inputobjs[i].disabled=!e.checked; }} </SCRIPT>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Related Article

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.