标签:新闻 ext cti put 编号 code 传智播客 doc 访问
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 <title>节点操作</title> 6 <script type="text/javascript"> 7 // table节点 8 function read_node_table() 9 { 10 var node_body = document.body; 11 var node_table = node_body.firstChild; 12 alert(node_table.nodeName); 13 } 14 // tr节点 15 function read_node_tr() 16 { 17 var node_body = document.body; 18 var node_table = node_body.firstChild; 19 var node_tbody = node_table.firstChild; 20 var node_trs = node_tbody.childNodes; 21 alert(node_trs[1].nodeName); 22 } 23 // td节点 24 function edit_node_td(){ 25 var node_body = document.body; 26 var node_table = node_body.firstChild; 27 var node_tbody = node_table.firstChild; 28 var node_trs = node_tbody.childNodes; 29 var node_tds = node_trs[1].childNodes; 30 var node_text = node_tds[2].firstChild; 31 node_text.nodeValue = "2016-12-31"; 32 } 33 </script> 34 </head> 35 <body><table border="1" rules="all"><tr><td>编号</td><td>新闻标题</td><td>发布日期</td></tr><tr><td>1234</td><td>广州传智播客</td><td>2016-12-12</td></tr></table> 36 <input type="button" value="访问table节点" onclick="read_node_table()" /> 37 <input type="button" value="访问tr节点" onclick="read_node_tr()" /> 38 <input type="button" value="修改日期" onclick="edit_node_td()" /> 39 </body> 40 </html>
标签:新闻 ext cti put 编号 code 传智播客 doc 访问
原文地址:http://www.cnblogs.com/CAODADA/p/6160776.html