首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

求 网页框架中的取值有关问题!

2012-02-09 
求 网页框架中的取值问题!!!!我想取框架中不同的网页的值 怎么取 我在框架中右边页面中给框架中上边页面的

求 网页框架中的取值问题!!!!
我想取框架中不同的网页的值 怎么取 我在框架中右边页面中给框架中上边页面的文本框初始化值 应该怎么做  

右边页面
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<label>
<input type="submit" name="Submit" value="提交" onclick="aa()"/>
</label>
</body>
</html>

<script language="javascript" type="text/javascript">
  function aa()
  {
parent.a.document.form1.textfield.value=="444"
  }
 </script>

左边页面
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
756757
</body>
</html>

上边页面
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<label></label>
<form id="form1" name="form1" method="post" action="">
  <input type="text" name="textfield" />
</form>
</body>
</html>

框架
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<frameset rows="145,*" cols="*" frameborder="no" border="0" framespacing="0">

  <frame src="a.html" name="a" scrolling="No" noresize="noresize" id="a" title="a" />
  <frameset rows="*" cols="201,*" framespacing="0" frameborder="no" border="0">
  <frame src="b.html" name="b" scrolling="No" noresize="noresize" id="b" title="b" />
  <frame src="c.html" name="c" id="c" title="c" />
  </frameset>
</frameset>
<noframes><body>
</body>
</noframes>
</html>

 拜托啦!!!!


[解决办法]

看了半天 不知道你是要从子框架取父框架的值 还是 父框架取子框架的值 ,还是??

子取子:
parent.window.frames["id"].

父取子:
window.frames["id"].

子取父:
parent.

[解决办法]
左边的页面:
parent.frames["a"].document.getElementById("textfield").value=="444"

热点排行