JavaScript学习笔记--第四章.框架间对象的调用

来源:互联网 发布:linux更改用户所属组 编辑:程序博客网 时间:2024/06/01 22:17

第四章.框架间对象的调用
1 操纵本表单里的文本框的数据
 document.form2.textfield2.value
 form2: 表单name
 textfield2:文件框name
  例:document.form2.textfield2.value=document.form1.textfield.value;

2 操纵父窗口的表单里的文本框的数据
 opener.document.form2.textfield2.value
 例:opener.document.form2.textfield2.value=document.form1.textfield.value

3 框架网页之间的表单的文本框之间数据传递
 parent.leftr.document.form2.textfield2.value
 leftr:框架的name
 例:parent.leftr.document.form2.textfield2.value=document.form1.textfield.value
4.操纵框架对象的函数
<INPUT TYPE="button" VALUE="调用" onClick="parent.fr1.hi()">
参数:
 fr1:同级框架名称
 hi:所调用框架对象页面中函数名
5.操纵同级框架对象所要载入的文件
(1).函数调用
<script language="JavaScript">
 <!-- Hiding
   function loadtwo(page2, page3) {
      parent.fr2.location.href=page2;
      parent.fr3.location.href=page3;
 }
 // -->
 </script>
参数:
 fr2、fr3:同级框架名
 page2、page3:同级框架所要载入的文件名
(2).页面装载
 <BODY onLoad="parent.fr3.location.href='getfr3.html'; return true;">
第四章.框架间对象的调用
1 操纵本表单里的文本框的数据
 document.form2.textfield2.value
 form2: 表单name
 textfield2:文件框name
  例:document.form2.textfield2.value=document.form1.textfield.value;

2 操纵父窗口的表单里的文本框的数据
 opener.document.form2.textfield2.value
 例:opener.document.form2.textfield2.value=document.form1.textfield.value

3 框架网页之间的表单的文本框之间数据传递
 parent.leftr.document.form2.textfield2.value
 leftr:框架的name
 例:parent.leftr.document.form2.textfield2.value=document.form1.textfield.value
4.操纵框架对象的函数
<INPUT TYPE="button" VALUE="调用" onClick="parent.fr1.hi()">
参数:
 fr1:同级框架名称
 hi:所调用框架对象页面中函数名
5.操纵同级框架对象所要载入的文件
(1).函数调用
<script language="JavaScript">
 <!-- Hiding
   function loadtwo(page2, page3) {
      parent.fr2.location.href=page2;
      parent.fr3.location.href=page3;
 }
 // -->
 </script>
参数:
 fr2、fr3:同级框架名
 page2、page3:同级框架所要载入的文件名
(2).页面装载
 <BODY onLoad="parent.fr3.location.href='getfr3.html'; return true;">