例如 <a href="#" onclick="showmap(213)">链接内容</a>如果获取到showmap(213)这段内容 通过javascript

解决方案 »

  1.   

    找到A元素!取它的属性即可<a href="#" id="a" onclick="showmap(213)">链接内容 </a> document.getElementById('a').getAttribute('onclick')
      

  2.   

    <a href="#" id=aa onclick="showmap(213)">チエスモトレネン </a> 
    <script>
    var i,j
    i=document.getElementById("aa").onclick.toString().indexOf("{");
    j=document.getElementById("aa").onclick.toString().lastIndexOf("}");
    alert(document.getElementById("aa").onclick.toString().substring(i+1,j));
    </script>
      

  3.   


    正解,当成XML的节点属性值来拿,
    如果想取里面的内容:
    document.getElementById('a').attributes["onclick"].nodeValue
      

  4.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>test</title>
    </head><body>
                  <a href="#" id="ab" onclick="showmap(213)">链接内容 </a> 
                  <script type="text/javascript">
                        alert(document.getElementById('ab').getAttribute('onclick').toString());
                  </script>
    </body></html>
      

  5.   

    这个不错!我写的哪个在IE6下会返回function anonymous(){
    showmap(213)
    }
      

  6.   

    2楼的有效果的 我刚才说的有点问题 能请你再帮我一下吗
    我在vb6 用WebBrowser控件打开一个网页 如何取得所有的链接的 onclick内容和链接文字