JS 将框架子窗口中的内容存放到父页面的div中

//index.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function getFrameBody()
{
    //将框架子窗口中的内容存放到父页面的div中
    //可以实现多子窗口的数据存入同一页面form内(父页面),并最终提交(父页面),这样可以确保跨页面的表单的完整性
    layer1.innerHTML=myframe1.document.all("table1").outerHTML;
}
</script>
</head>
<body>
<iframe id="myframe1" frameborder=1 scrolling=auto src="2.htm"></iframe>
<input type="button" value="Click Me" οnclick="getFrameBody();"/>
<div style="position: absolute; width: 487px; height: 263px; z-index: 1; left: 361px; top: 20px; border: 3px dashed #99CC00; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px" id="layer1">
</div>
</body>
</html>

//2.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>a</title>
</head>
<body>
<table border="1" width="100%" id="table1">
<tr>
    <td><input type="text"/></td>
    <td><input type="text"/></td>
</tr>
<tr>
    <td><input type="text"/></td>
    <td><input type="text"/></td>
</tr>
</table>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值