2
的index.html此代碼如何用JS或jQuery的
<iframe src="other.html" width="100%" height="600px"></iframe>
<input type="button" id="btnOutside" value="Click me"/>
的一個iframe的內容在other.html交互我有這樣的代碼:
<input type="button" id="btnInside" value="Other Click"/>
<script type="text/javascript">
$(document).ready(function() {
$("#btnInside").click(function() {
alert('inside');
});
});
</script>
我想使外部按鈕觸發這樣的內部按鈕index.html
<script type="text/javascript">
$(document).ready(function() {
$("#btnOutside").click(function() {
$("#btnInside").click();
});
});
</script>
但是是行不通的。我能做什麼??
感謝隊友的工作原理。 – kilkadg 2013-02-22 17:34:33