框架网页 top left main, 从main frame 中访问 top中的元素怎么办?

在top中,<input type="text" value="abc" id="abc">

在main中有一个按纽<input type="button" onclick="changeValue();">

<script>
function changeValue(){
怎么样写js改变top中文本框的值
}
</script>

第1个回答  推荐于2016-09-05
分别列出三个文件的内容如下:

(1) frame.html
<frameset rows="30%, 70%">
<frame name="topframe" src="top.html">
<frameset cols="40%, 60%">
<frame src="left.html">
<frame src="main.html">
</frameset>
</frameset>

(2) top.html
<input type="text" value="abc" id="abc">

(3) main.html
<input type="button" onclick="changeValue();">

<script>
function changeValue(){
parent.topframe.abc.value='I have be changed!!!';
}
</script>本回答被提问者采纳
第2个回答  推荐于2016-09-11
分别列出三个文件的内容如下:

(1) frame.html
<frameset rows="30%, 70%">
<frame name="topframe" src="top.html">
<frameset cols="40%, 60%">
<frame src="left.html">
<frame src="main.html">
</frameset>
</frameset>

(2) top.html
<input type="text" value="abc" id="abc">

(3) main.html
<input type="button" onclick="changeValue();">

<script>
function changeValue(){
parent.topframe.abc.value='I have be changed!!!';
}
</script>
第3个回答  2019-03-01
分别列出三个文件的内容如下:
(1)
frame.html
<frameset
rows="30%,
70%">
<frame
name="topframe"
src="top.html">
<frameset
cols="40%,
60%">
<frame
src="left.html">
<frame
src="main.html">
</frameset>
</frameset>
(2)
top.html
<input
type="text"
value="abc"
id="abc">
(3)
main.html
<input
type="button"
onclick="changeValue();">
<script>
function
changeValue(){
parent.topframe.abc.value='I
have
be
changed!!!';
}
</script>

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网