javascript 如何操作框架页中的域

<html>

<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>新建网页 2</title>
</head>
<frameset rows="64,*,64">
 <frame name="top" scrolling="no" noresize target="contents" src="top.htm">
 <frameset cols="150,*">
  <frame name="contents" target="main" src="left.htm">
  <frame name="main" src="right.htm">
 </frameset>
 <frame name="bottom" scrolling="no" noresize target="contents" src="bottom.htm">
 <noframes>
 <body>

 <p>此网页使用了框架,但您的浏览器不支持框架。</p>

 </body>
 </noframes>
</frameset>

</html>

 任意框架中的叶均可以通过window.parent.frames[]数组获得其他框架并操作其中的域,数组从0开始计数,分别表示按上页中的前后顺序获得.

window.parent.frames[1].document.leftform.input3.value = "" 此语句表示设置TOP.HTML页面中的INPUT3控件的值.

原文地址:https://www.cnblogs.com/jiangchongwei/p/1282957.html