繁体   English   中英

如何将复选框值从一个iframe传递到另一iframe

[英]How to pass a checkbox value from one iframe to another iframe

我有两个iframe(比如说iframe A和B)。 Iframe A显示一个表格,其中第一列包含复选框。 每当用户标记该复选框时,我都希望将该复选框中的值传递给iframeB中的pageB。下面提供了该复选框的部分代码。 我将不胜感激。 谢谢

<tr>
<td class='am'>
<form action='pageB.php' method='post' target='iframe-pageB'  id='pageA'>
<input name='checkselect' type='checkbox' value='$first_string|$second_string'>$combined_string</input>
</form>
</td>

您可以使用以下方法引用第二个iframe:

var iframe2 = parent.document.getElementById('iframe2');

然后可以通过以下方式引用后续元素:

var doc = iframe2.contentDocument? iframe2.contentDocument: iframe2.contentWindow.document;
// reference to display text box
var field = doc.forms['iframe2DemoForm'].elements['display'];

这应该有帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM