我有这样的代码:http://jsfiddle.net/AH4As/3/
它在小提琴上工作,但在我的网站上,它不能。我在Web Inspector中遇到此错误
Tracking.js:4TypeError: 'undefined' is not an object (evaluating '$('a').attr('onClick').replace')有人知道哪里出问题了吗?
这是我的源代码:http://jsfiddle.net/AH4As/24/
发布于 2012-02-15 09:54:20
页面上的其他锚点导致查询失败,简而言之,这是我的解决方案:
<script type="text/javascript">
$(document).ready(function(){
$('a[onclick^="window.open(\'TrackPackage.asp"]').attr('onClick', $('a[onclick^="window.open(\'TrackPackage.asp"]').attr('onClick').replace("window.open('", "window.open('http://eastcoasttvs.com/"));
});
</script>发布于 2012-02-14 09:47:28
更新:
$(document).ready(function(){
$('a').attr('onClick', $('a').attr('onClick').replace("window.open('", "window.open('http://example.com/"));
});
http://jsfiddle.net/AH4As/10/
下面是一个提示,告诉你代码已经被修改了:http://jsfiddle.net/AH4As/11/
发布于 2012-02-14 10:01:25
尝试:
$('a').removeAttr('onclick').click(function(){window.open('http://example.com');return false;});https://stackoverflow.com/questions/9270607
复制相似问题