<table>
<tr>
<td>
<a id="abs" href="#">abs</a>
</td>
</tr>
</table>如上代码所示:
我该如何通过javascript 读取table中的 标签a呢?
实践证明var a=document.getElementById("abs")是无法读到该标签的
在此请各位大哥大姐指教,谢谢 

解决方案 »

  1.   

    不行吗?!
    我测试怎么可以.
    <html>
    <body>
    <a id="link1" href="aaa">link</a><input type="button" value="b1" onclick="func()" />
    <script type="text/javascript">
    function func(){
    alert(document.getElementById("link1").href);
    }
    </script>
    </body></html>
      

  2.   

    不放在table标签里面是可以的
      

  3.   

    测试可以
    <!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" ><body>
    <table>
    <tr>
    <td>
    <a   id="abs"   href="#abc"> abs </a>
        <input id="Button1" type="button" value="button" onclick="func()" />
    </td>
    </tr>
    </table> 
    <script type="text/javascript">function func(){
    alert(document.getElementById("abs").href);
    }
    </script>
    </body></html>