1. 看到W3C教程知道IE和FF不支持NamedNodeMap.setNamedItem(),不信,做了实验:
    W3school教程的准确性真的像大家想象的那样吗
  2. 代码如下:
     1 <!doctype html>
     2 <html>
     3 <head>
     4 <meta charset="utf-8">
     5 <title>DOM节点操作总结</title>
     6 <script>
     7 window.onload=function(){
     8     var $=function(id){
     9         return document.getElementById(id);
    10     }
    11     $("baiduSearch").onclick=function(){
    12         var att = document.createAttribute("align");
    13           att.value = "center";
    14         this.attributes.setNamedItem(att);    
    15     }
    16 }
    17 </script>
    18 </head>
    19 
    20 <body>
    21 <a href="javascript:void(0)" title="baidu" id="baiduSearch">点击获取连接title</a>
    22 </body>
    23 </html>

    W3school教程的准确性真的像大家想象的那样吗

  3. 所以,大家在学习W3C教程的时候还是要多多尝试,不要被误导,而且据群里一位同学说http://www.w3school.com并不隶属w3c组织。

相关文章:

  • 2021-11-19
  • 2021-09-25
  • 2021-05-09
  • 2021-04-23
  • 2021-08-03
  • 2021-05-16
  • 2021-05-28
  • 2021-08-17
猜你喜欢
  • 2021-12-23
  • 2021-07-04
  • 2021-06-20
  • 2021-12-31
  • 2021-07-26
  • 2021-04-11
  • 2021-06-19
相关资源
相似解决方案