父页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<div style="width:1000px; height:300px;">
<input type="text" id="Select1" name="Select1" value="12222" />
<span id="Select2">122222</span>
</div>
<div><iframe src="3.html" width="720" height="300" scrolling="no" frameborder="0"  name="SelectFrame" id="SelectFrame" ></iframe></div>
</body>
</html>
子页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
function ShowSelect(){
   top.parent.document.getElementById("Select1").value ="3333333";
   top.parent.document.getElementById("Select2").innerText ="333333";
}
</script>
</head>
<body bgcolor="#00CC66">
<input type="button" onclick="ShowSelect"  name="button1" id="button1" value="测试"/>
</body>
</html>
我想通过这样去改变 父页面的值,可总是不行怎么办?做一个东西做几天了最后一个关卡,不行就完蛋了。

解决方案 »

  1.   

    windows.opener.document.getElementById("Select1").value ="3333333";
      

  2.   

    看错了,请无视1楼。直接用parent.document呢
      

  3.   


     onclick="ShowSelect()"
      

  4.   

    不需要top, 直接 parent.xxx
    parent.document.getElementById("Select1").value ="3333333";
    parent.document.getElementById("Select2").innerText ="333333";
      

  5.   

    又是这个问题
    <input type="button" onclick="ShowSelect()"name="button1" id="button1" value="测试"/>