function chkme()
  {
var r=new Array();
 var obj=document.getElementsByTagName("a")
 for(var i=0;i<obj.length;i++){
  alert(i.href);
    }
}

解决方案 »

  1.   

    var _a = document.getElemebtsByTagName("a");
    for(i = 0;i<_a.length;i++)
    {
    alert(_a[i].href);
    }试试...
      

  2.   

    不好意思,我没描述清楚,我的意思是获取指定网页上的超链接,比如http://www.baidu.com
      

  3.   

    document.links就是页面所有的超级连接属性,虽然很少用<html xmlns="http://www.w3.org/1999/xhtml">
    <script language="javascript"> 
        function getLinks()
        { 
          for(var i=0; i<document.links.length; i++)
          {
            alert(document.links[i].href);
          }
        } 
    </script> 
    <body>
    <a href="http://www.baidu.com">Baidu</a>
    <a href="http://www.163.com">163</a>
    <input type="button" value="Test" onclick="getLinks();" />
    </body>
    </html>