请教一个超级链接 onclick 问题 例如 <a href="#" onclick="showmap(213)">链接内容</a>如果获取到showmap(213)这段内容 通过javascript 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 找到A元素!取它的属性即可<a href="#" id="a" onclick="showmap(213)">链接内容 </a> document.getElementById('a').getAttribute('onclick') <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> 正解,当成XML的节点属性值来拿,如果想取里面的内容:document.getElementById('a').attributes["onclick"].nodeValue <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> 这个不错!我写的哪个在IE6下会返回function anonymous(){showmap(213)} 2楼的有效果的 我刚才说的有点问题 能请你再帮我一下吗我在vb6 用WebBrowser控件打开一个网页 如何取得所有的链接的 onclick内容和链接文字 哪一句被360浏览器拦截了呢 大家帮帮个忙!!!! jquery高手进 40分求用javascript实现票据的套打功能! 小菜写了一段jquery没有达到预想的结果,烦请高手帮忙 jquery里tab的close事件怎么用? 获取地址栏中的URL地址 数组问题 .送分 为什么下面的JavaScript代码出错? 一个处理帧的问题,一定给分!!! 如何用js把字符串"180px"变成数字180,在线等! 汇率
<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>
正解,当成XML的节点属性值来拿,
如果想取里面的内容:
document.getElementById('a').attributes["onclick"].nodeValue
<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>
showmap(213)
}
我在vb6 用WebBrowser控件打开一个网页 如何取得所有的链接的 onclick内容和链接文字