0

必要なのは、特定の要素 ID が iframe 内に読み込まれる場合にのみ、親ページのフォームを表示することだけです。親/iframe は同じドメインにあります。javascriptを使用してそれを達成するにはどうすればよいですか?

<form id="Search" action="../search.php" target="my-iframe" method="post">
<input type="text" id="location" name="keywords[all_words]"  />
<a href="#" onclick="document.getElementById('Search').submit()" >Search</a>
</form>

<iframe id="myiframe" src="../page.html" name="myiframe" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
4

2 に答える 2

1

jQuery を使用して、loadイベントを iframe に添付できます。これが実際の例です:http://jsfiddle.net/kPqbS/

于 2013-04-12T21:17:35.677 に答える