我正在做一个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