日期:2014-05-16 浏览次数:20443 次
<!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> <TITLE>Test Page</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script language="javascript"> function show(){ //改变iframe中的元素id为myH1的内容 window.frames["iframe_text"].document.getElementById("text1").value= this.document.getElementById("textarea2").value; } </script> </HEAD> <BODY> <h2>父窗体</h2> <iframe height="350" width="600" src="ht1.html" name="iframe_text"></iframe> <form method="post"> <input name="haha" id="text2" type="text" maxlength="30" /> <br /> <textarea cols="50" rows="5" id="textarea2"></textarea> <input type="button" onClick="show();" value="提交"/> </form> </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> </head> <script language="javascript"> function show(){ //改变父窗体中的元素id为myH2的内容 parent.document.getElementById("text2").value =this.document.getElementById("textarea1").value ; } </script> <body> <h1 >子窗体</h1> <form method="post"> <input name="abc" id="text1" type="text" maxlength="30"/><br /> <textarea cols="50" rows="10" id="textarea1"></textarea> <br /> <input type="button" value="提交" onclick="show();"/> </form> </body> </html>