index.html内容:
1
2
|
<
iframe
id
=
"mpage"
name
=
"mpage"
onload
=
"AdaptorHeight()"
style
=
"border-style: none; height: 100%;width: 100%;"
scrolling
=
"auto"
frameborder
=
"0"
src
=
"test.html"
>
|
test.html内容:
1
2
3
|
<
form
name
=
"f1"
id
=
"f1"
action
=
""
method
=
"post"
>
<
input
name
=
"uid"
id
=
"uid"
type
=
"text"
value
=
"input"
/>
</
from
>
|
方法一:通过ID获取
1
|
var
name = parent.document.getElementById(
"mpage"
).contentWindow.document.getElementById(
'uid'
).value;
|
方法二:通过Form获取
1
|
var
name1 = parent.document.getElementById(
"mpage"
).contentWindow.document.forms[
'f1'
].uid.value;
|
本文转自stock0991 51CTO博客,原文链接:http://blog.51cto.com/qing0991/1427477,如需转载请自行联系原作者