caoyinghui

框架中取值问题

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

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <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 onclick="flushMenuFrame();">刷新框架Menu窗口的页面</button> Bar页面的文本框:<input type="text" id="barText" value="Bar页面的值1"><button onclick="writeValueToMainFrame();">向Main窗口写值</button> </body> </html>

DEMO003_main.html

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> </head>

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

 

作者:caoyinghui1986 发表于2008-6-15 12:24:00 原文链接
阅读:267 评论:0 查看评论

posted on 2008-06-15 04:24 shine_panda 阅读(71) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜