谁能帮我解决这问题,100分!!!!!!不够分可以再加!

hllcn 2004-11-05 02:56:42
有这三个文件
index.html ---> http://localhost/index.html;
myhtc.htc ---> http://localhost/myhtc.htc;
mypage.aspx ---> http://localhost/mypage.aspx;

在index.html里嵌入myhtc组件.
在myhtc组件里,有个iframe,嵌入了mypage.aspx;
在mypage.aspx里有个TextBox,name="mytext" value = "123456789";

问题。在index.html页面显示了,想在index 下调用myhtc组件里的一个方法。而该方法返回iframe页面里的TextBox的值。我试了好多次,总得不到.能实现么?怎么实现?请给于例子说明。如果不能实现,请给出别一种方法.

index.html文件里:
<script language="javascript">
var vv = myhtc.getvalue();
</script>
<html xmlns:Test="my.com.cn">
<body>
<?IMPORT NAMESPACE="Test" IMPLEMENTATION="myhtc.htc">
<Test:myhtc id="myhtc" >
</Test:myhtc>
</body>
</html>
-------------------------------------------------------------------------

myhtc.htc文件里:
<script language="javascript">
function getvalue()
{
return myframe.document.myform.mytext.value;
}
</script>
<IFRAME id="myframe" name = "myframe" src="mypage.aspx"></IFRAME>
-------------------------------------------------------------------------

mypage.aspx文件里:
<body>
<form id="myform">
<input type="text" name="mytext" value="123456789">
</form>
</body>



谢谢~
...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hllcn 2004-11-05
  • 打赏
  • 举报
回复
太历害了你。终于解决了.谢谢。
8080 2004-11-05
  • 打赏
  • 举报
回复
return document.getElementById('myframe').contentWindow.document.myform.mytext.value;

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧