星空网 > 软件开发 > 网页设计

为什么document.firstChild找到的不是html节点

DOM是针对HTML4.01开发的,我们现在是XHTML1.0.

所以要想使用核心DOM中的属性和方法,必须去掉DTD类型定义。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html ="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <meta name="author" content="" /> <link rel="stylesheet" type="text/css" href="" /> <style type="text/css"></style> <script type="text/javascript"></script> </head> <body> <table width="500" border="1">   <tr>      <td>姓名</td>      <td>性别</td>      <td>年龄</td>   </tr>   <tr>      <td>奥特曼</td>      <td>男</td>      <td>26</td>   </tr> </table> <input type="button" value="查找table节点" onclick="find_table_node()"> <input type="button" value="修改男为女" onclick="edit_text_node()"> <script type="text/javascript">    function find_table_node(){      //查找html节点      var node_html=document.firstChild;      //alert(node_html); 结果是对象    } </script> </body></html>

为什么document.firstChild找到的不是html节点为什么document.firstChild找到的不是html节点




原标题:为什么document.firstChild找到的不是html节点

关键词:HTML

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

看完这个老外分享的询价攻略,不禁感慨套路太深!:https://www.ikjzd.com/articles/1562641072321716225
进口再创纪录!美国港口备受压力:https://www.ikjzd.com/articles/1562649557855064065
永久终止账户!北美电商平台又一波大批量封店:https://www.ikjzd.com/articles/1562685812934479874
中国宠物用品火遍全球,韩国宠物经济有超10亿美元市场空缺:https://www.ikjzd.com/articles/1562688318488698882
亚马逊欧洲站夏末促销&返校季提报已开启!卖家如何趁势大卖:https://www.ikjzd.com/articles/1562737693553545218
亚马逊日本站新政策改革,你能玩“赚”2019吗:https://www.ikjzd.com/articles/15628
桂林酒店销售多少钱 桂林旅游宾馆价格:https://www.vstour.cn/a/410227.html
十里银滩旅游攻略玩什么住哪里怎么去?:https://www.vstour.cn/a/410228.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流