我正在做一個Android Web目錄,因此我不得不使用iframe。然而,我想問,是否可以點擊iframe中的按鈕並使代碼在主頁面中工作?iframe中的目標按鈕?
這是我的代碼:
function initFastButtons() {
new FastButton(document.getElementById("CloseButton"), runclose);
new FastButton(document.getElementById("OpenButton"), runopen);
};
function runclose() {
$('.full-preview-viewer').hide();
};
function runopen() {
$('.full-preview-viewer').show();
};
而且這是在iframe中的按鈕看起來像:
<input id="OpenButton" type="image" src="products/special/product1.png" name="image" width="336" height="593"></input>
謝謝大家:)
Hey Jason,我有點困惑。我在[iframe](http://www.nightlifebratislava.com/demos/mobile7/special.html)中創建了一個單獨的jquery代碼,它執行一個執行'parent.runopen();'的函數。但這不起作用(它也不適用於PC,但這很正常)。 [這裏是主頁](http://www.nightlifebratislava.com/demos/mobile7) – pufAmuf 2012-03-03 18:18:50
它現在有效,謝謝! – pufAmuf 2012-03-03 18:31:45