父窗口如何得到子窗口中文本框的值? var myID=document.frames["frame的name"].document.getElementById('文本框的id') 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的正确,这里有篇框架内的调用,对你可能有用 http://www.fzic.net/SrcShow.asp?Src_ID=158 opener.document.getElementById('文本框的id') 是这样吗?father.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=utf-8" /><title>无标题文档</title>[code=JScript]<script type="text/javascript"> var oWin=null; function OpenWindow(){ oWin=window.open("child.html",'_blank',"width=100 height=200"); } function GetValue(){ if(oWin){ alert(oWin.document.getElementById('txtInput').value); } else alert("窗口还没有打开!"); }</script></head><body><form id="form1" name="form1" method="post" action=""> <label> <input type="button" name="btnOpen" id="btnOpen" value="打开窗口" onclick="OpenWindow()"/> </label> <label><input type="button" name="btnGet" id="btnGet" value="获取值" onclick="GetValue()"/></label></form></body></html>[/code]child.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=utf-8" /><title>无标题文档</title></head><body><form id="form1" name="form1" method="post" action=""> <label> 子文本框 <input name="txtInput" type="text" id="txtInput" value="123" /> </label></form></body></html> opener.document.getElementById("id").value function openprint() //打印 { var myID =这opener.document.getElementById("txtInput").value//.............} 谢谢大家,父窗口打开的是一个DIV做的模拟窗口,模拟窗口包含<IFRAME id=winrp style="WIDTH: 160px; HEIGHT: 155px" name=winrp_content src="cc.htm" frameBorder=0> </IFRAME>现在就是如何取得CC.htm中的一个文本框的值 window.winrp_content.document.all.txtID.value 是这样啊.那你应该首先获得div中窗口对象的引用(你最好将iframe的id和name都写上否则ff可能不行)window.frames["winrp"].document.getElementById("文本框id").value由于不能测试所以不能保证它的正确性你调试一下吧 求一段正则式 刚到新公司熟悉源码,看到一个写法 求教 滚动效果JS,IE8下无法首尾衔接 javascript如何处理FIREFOX的中文参数编码问题 谁能给我个树的例子? 这段js代码是什么意思? js调用css的问题 发布一个日期选择控件 !寻求JavaScript集成开发环境(IDE),JavaScript 特效 跪求大佬解决js问题四级难度 我把17173下载站首页按字母选游戏那个弄到自己机器上面读取代码到首页出来中文是乱码,请问怎么搞``? 非常急,在线求解一小问题!
father.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=utf-8" />
<title>无标题文档</title>
[code=JScript]<script type="text/javascript">
var oWin=null;
function OpenWindow(){
oWin=window.open("child.html",'_blank',"width=100 height=200");
}
function GetValue(){
if(oWin){
alert(oWin.document.getElementById('txtInput').value);
}
else
alert("窗口还没有打开!");
}
</script></head>
<body><form id="form1" name="form1" method="post" action="">
<label>
<input type="button" name="btnOpen" id="btnOpen" value="打开窗口" onclick="OpenWindow()"/>
</label>
<label>
<input type="button" name="btnGet" id="btnGet" value="获取值" onclick="GetValue()"/>
</label>
</form>
</body>
</html>[/code]child.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=utf-8" />
<title>无标题文档</title>
</head><body>
<form id="form1" name="form1" method="post" action="">
<label>
子文本框
<input name="txtInput" type="text" id="txtInput" value="123" />
</label>
</form>
</body>
</html>
function openprint() //打印
{
var myID =这opener.document.getElementById("txtInput").value
//.............
}
父窗口打开的是一个DIV做的模拟窗口,模拟窗口包含<IFRAME id=winrp style="WIDTH: 160px; HEIGHT: 155px" name=winrp_content src="cc.htm" frameBorder=0> </IFRAME>
现在就是如何取得CC.htm中的一个文本框的值
window.frames["winrp"].document.getElementById("文本框id").value由于不能测试所以不能保证它的正确性你调试一下吧