iframe.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js" type="text/javascript"></script>
<script>
$(function(){
});
</script>
</head>
<body>
<table border="1" width="100%" height="100%">
<tr>
<th><iframe id="i1" width="100%" height="100%"src="iframe_file1.html"></iframe></th>
<th><iframe id="i2" width="100%" height="100%"src="iframe_file1.html"></iframe></th>
</tr>
</table>
</body>
</html>
iframe_file1.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script>
$(document).ready(function(){
$('body').click(function(e){
console.log("iframe clickq1");
console.log(e);
$('#i2', window.parent.document).contents().find('body').trigger(e);
});
});
</script>
</head>
<body>
<a href="#" onclick="alert('first link')">first link</a>
<input type="button" value="Click me" id="button_click">
</body>
</html>
当单击链接或按钮事件被触发但如果在此行中将 i2 更改为 i1 则不会在第二个 iframe 上触发
$('#i2', window.parent.document).contents().find('body').trigger(e);
那么它的工作为什么 i2 不工作我该怎么办?