我试图打开一个超链接与目标=“空白”。jQuery跟着一个目标超链接=“_ blank”
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
jQuery(window).load(function() {
$('a').click();
});
</script>
</head>
<body>
<a href="http://www.google.com" target="_blank">Report</a>
</body>
</html>
实际上,click()的确触发了一个点击事件,就像触发器一样。如果你传递一个参数,它只会注册一个事件处理程序。查看jquery文档:http://docs.jquery.com/Events/click – 2009-10-15 18:19:20
我阅读了您提到的docs.jquery.com页面,但没有使用cick事件的示例。 – 2009-10-15 18:33:32
谢谢ceejayoz,但这仍然无法正常工作。 (函数($){ $('a')。trigger('click'); }); – 2009-10-15 18:37:40