从Iframe检索List并使用List更新父帧
Retrieving List from Iframe and updating parent frame with List
我是一个noob,正试图从Iframe中检索HTML列表,并通过按下父框架中的按钮来更新父框架内的列表。请帮忙,我一直在检索一个错误"UpdateList未定义",我知道我一定做错了什么,目前我想把头撞在墙上,请求帮助
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
<script type="text/Javascript">
function UpdateList(){
var OldList = document.getElementById('Framed');
var Newlist = OldList.contentWindow;
document.getElementById('FileList').innerHTML= Newlist;}
</script>
</style>
</head>
<body style="color:white">
<div id="FileList">
<select>
<option>Push Refresh</option>
</select>
</div>
<iframe NAME="Framed" id="Framed" src="DirectoryPreview.php" width="250" height="100">
</iframe>
<br>
<button onclick="UpdateList()">Push to refresh</button>
</body>
**Correction for the above, hope it helps others struggling**
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
</style>
<script type="text/Javascript">
function UpdateList(){
var OldList = document.getElementById('Framed');
var NewList = OldList.contentDocument || iframe.contentWindow.document;
var Contents = NewList.getElementById('List').value;
document.getElementById('FileList').innerHTML= Contents;}
</script>
</head>
<body style="color:Black">
<div id="FileList">
<select>
<option>Push Refresh</option>
</select>
</div>
<iframe NAME="Framed" id="Framed" src="DirectoryPreview.php" width="250" height="100">
</iframe>
<br>
<button onclick="UpdateList()">Push to refresh</button>
</body>
</html>
您的javascript嵌入在style tag
中!!!!你怎么能指望它执行???
更改:-
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
</style>
<script type="text/Javascript">
function UpdateList(){
var OldList = document.getElementById("Framed");
var Newlist = OldList.contentWindow;
document.getElementById("FileList").innerHTML= Newlist;
}
</script>
相关文章:
- Javascript循环不会自我更新
- 添加文字和评论功能更新Div
- AngularJS:ng之后,重复$scope值未按预期更新
- 如何通过数组更新角度子范围
- Ajax聊天消息重复而不仅仅是更新
- 通过CSV文件上载更新数据库表
- 平均值:无法将数据更新到数据库
- $rootScope未使用forEach进行更新
- d3基于用户选择动态更新节点
- 有条件更新d3.js力图中节点的最佳方法
- Angular:更新一次性绑定的数据
- Javascript更新孙窗口中的表单元素
- 使用AngularJS中的筛选器更新给定的表
- 从Iframe检索List并使用List更新父帧
- 在嵌套的Map和List中更新值
- Angular js -在删除元素后更新ng-repeat list
- 删除angularjs后,List不会更新
- 每隔X秒更新listTicker函数中的list属性
- 当向数组添加元素时,n -list输入不更新
- Knockout模板在添加到可观察数组时不会更新list