将文本从IFRAME复制到父页面的INPUT字段中 [英] Copying text from IFRAME into the INPUT field on the parent page

查看:63
本文介绍了将文本从IFRAME复制到父页面的INPUT字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当访客在框架页面的输入"字段中键入文本后单击按钮时,是否可以将键入的文本复制到父页面的输入"字段中?

When the visitor clicks the button after typing a text in the INPUT field which is in a framed page , is it possible to copy the typed text into the INPUT field which is on the parent page ?

内陷的网页代码:page1.html

iframed page code : page1.html

<form action="">
   Search:<input type="text" name="searchname"><input type="submit" value="send" size="45">
</form>

父页面:

<IFRAME id="iframe1" src="page1.html"></IFRAME><BR>

   You searched:<INPUT type="text" id="result">

我希望搜索到的项目显示在父页面上.谢谢.

I want that the searched items display on the parent page. Thanks.

推荐答案

在父级中创建接收文本的功能...

In parent Create function which receive text...

function UpdateSearchNameToResult(msg){
   document.getElementById('result').value = msg;
}


在iframe中创建发送搜索名称的功能"page1.html"上的提交"按钮


In iframe Create function which send search name for submit button on "page1.html"

并调用 parent.UpdateSearchNameToResult(yourval);

这篇关于将文本从IFRAME复制到父页面的INPUT字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆