我有这个代码:
<ul>
<li>
<a href="http://www.yahoo.com"
onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
return false;" >Go to Yahoo
</a>
</li>
<li>
<a href="http://www.facebook.com"
onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
return false;" >Go to Facebook
</a>
</li>
<li>
<a href="http://www.google.com"
onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
return false;" >Go to Google
</a>
</li>
</ul>
如何使onclick
jQuery适用于所有列表项?谢谢你
向a
需要此功能的每个元素中添加一个类,然后执行以下操作:
$('a[href].yourClass').click(function(){
window.open($(this).attr('href'), 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
return false;
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句