简体   繁体   English

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

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

I have two iframes (let say iframe A and B). 我有两个iframe(比如说iframe A和B)。 Iframe A displays a table where the first column contains checkbox. Iframe A显示一个表格,其中第一列包含复选框。 Whenever user marks the checkbox, I want the value in that checkbox to be passed to pageB in iframeB.Part of the code for my checkbox is given below. 每当用户标记该复选框时,我都希望将该复选框中的值传递给iframeB中的pageB。下面提供了该复选框的部分代码。 I would appreciate any help given. 我将不胜感激。 Thanks 谢谢

<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>

You can reference the second iframe using: 您可以使用以下方法引用第二个iframe:

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

And then the subsequent elements can be referenced by: 然后可以通过以下方式引用后续元素:

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

This should help 这应该有帮助

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

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