我试图在复选框点击时将div标签显示给另一个框架集.
我的index.html文件是
<html>
<head>
<title></title>
</head>
<frameset cols="25%,75%">
<frame src="left-panel.html"></frame>
<frame src="right-panel.html"></frame>
</framset>
</html>
Run Code Online (Sandbox Code Playgroud)
左panel.html
<html>
<body>
<script src="min.js"></script>
<script src="file.js"></script>
<input type="checkbox" value = "1" class="theClass">Click<h1>
<input type="checkbox" value = "2" class="theClass">Click<h1>
<input type="checkbox" value = "3" class="theClass">Click<h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
右panel.html
<html>
<body>
<script src="min.js"></script>
<script src="file.js"></script>
<div id="footer" style="width:98%; background:blue; height:10%; position:absolute; bottom:0; visibility:hidden;"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
然后我的js文件是
$('.theClass').change(function(){
($('.theClass:checked').map(function(){ myfunction(this.value); }).get())
});
function myfunction(ad)
{
document.getElementById("footer").innerHTML = ad;
}
Run Code Online (Sandbox Code Playgroud)
单击复选框时,我想将这些复选框值显示在另一个html的页脚div中
首先定义框架的名称:
<frameset cols="25%,75%">
<frame name="left" src="left-panel.html"></frame>
<frame name="right" src="right-panel.html"></frame>
</framset>
Run Code Online (Sandbox Code Playgroud)
然后在javascript中:
function myfunction(ad) {
top.left.document.getElementById("footer").innerHTML = ad;
}
Run Code Online (Sandbox Code Playgroud)
您只能访问父级:
function myfunction(ad) {
parent.left.document.getElementById("footer").innerHTML = ad;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3267 次 |
| 最近记录: |