如题 类似font Strong

解决方案 »

  1.   

    <html>
        <head>
            <title></title>
            <script type="text/javascript">
    window.onload = function() {
    alert(document.getElementsByTagName("strong").length);
    };        </script>
        </head>    <body>
            <strong></strong>
        </body>
    </html>
      

  2.   

    JQuery
    很容易即可获取所有的
      

  3.   

    getElementsByTagName用过 我得不到
      

  4.   

    document.all也不行 不坐垫是不是我用错了 ,谁能给个具体的代码吗?
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <body >
    <font></font>
    <font></font>
    <strong></strong>
    <strong></strong>
    <script>
    alert(document.getElementsByTagName("font").length);
    alert(document.getElementsByTagName("strong").length);
    </script>
    </body>
      

  6.   

    document.getElementsByTagName
    document.getElementsByName
    document.getElementById