框架中取值问题

DEM003.html

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
  
<head>  
  
</head>  
  
  
  
<frameset rows="70,*" cols="*" framespacing="0" frameborder="yes" style="border:0px">  
  
  <frame src="DEMO03_bar.html" name="bar" scrolling="No" noresize="noresize" id="bar"arginwidth="0" marginheight="0" />  
  
  <frameset cols="150,*" frameborder="yes" border="1" framespacing="0">  
  
    <frame src="DEMO03_menu.html" name="menu" scrolling="No" noresize="noresize" id="menu" marginwidth="0" marginheight="0" />  
  
    <frame src="DEMO03_main.html" name="mainFrame" id="main" marginwidth="0" marginheight="0" />  
  
  </frameset>  
  
</frameset>  
  
<noframes><body>  
  
</body>  
  
</noframes></html>  


 

DEM003_bar.html

<html>
<head>
<script>
	//补充完成此函数,用于刷新Menu窗体的页面
	  function flushMenuFrame(){      
	  //top表示顶级窗口 的 window对象   
	  window.top.menu.location.href="DEMO03_menu.html";  
	  }  

	//补充完成此函数,将barText文本框的值写入到Main窗口的mainText中去。 
	 function writeValueToMainFrame(){      
	 //parent表示 但前窗口的 上级窗口的 window对象      
	   window.parent.mainFrame.document.getElementById("mainText").value=document.getElementById("barText").value;   
	 }
</script>

</head>

<body>
<center>BAR页面</center>
<button οnclick=flushMenuFrame();;>刷新框架Menu窗口的页面</button>
Bar页面的文本框:
<input type="text" id="barText" value="Bar页面的值1">
<button οnclick=writeValueToMainFrame();;>向Main窗口写值</button>
</body>
</html>

 

DEMO003_main.html

 <html> <head> </head>

<body> <center>Main窗体</center> <br><br> Main窗体中的文本框 <input type="text" id="mainText" value="Main页面的值2"> </body> </html>

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值