像這樣:是否可以訪問HTML外部iframe(從iframe)?
<!DOCTYPE html>
<html>
<meta><script type="text/javascript" src="jquery1.x.js"></script></meta>
<body>
<iframe src="myiframe.html">
</iframe>
<div class="dialog" style="display:none;">
Hello world!
</div>
</body>
</html>
(myiframe.html)
<script type="text/javascript">
$('.dialog').show();
</script>
也許使用AJAX?
您可以從iframe訪問父窗口,然後可以相應地執行其腳本。 – 2013-02-27 08:01:04
'window.top'使您可以從iFrame中訪問iFrame的父窗口。 – adeneo 2013-02-27 08:02:02