上次那个页面写入的问题是我没有表达清楚意思我说的重新可以写入的页面是 写入代码到IF框架 然后由他显示成页面<iframe src="http://www.baidu.com" id="if1"> </iframe> var t=document.getElementById("tx1");
var i=document.getElementById("if1").contentWindow.document;
i.write(t.value);
i.close();
var i=document.getElementById("if1").contentWindow.document;
i.write(t.value);
i.close();
你的意思是想在那个if框架里显示value
<html>
<head>
<script type="text/javascript">
window.onload = function(){
document.getElementById('click').onclick = function(){
var tx = document.getElementById('tx');
var if1 = document.getElementById('if1').contentWindow; //用来加载新页面
if1.location = 'zzzzz.html#' + tx.value;
};
};
</script>
</head>
<body>
<iframe id="if1"> </iframe>
<input type="button" id="click" value="click" />
<input type="text" id="tx" />
</body>
</html>
在a.html页面的文本框里写HTML标签如<div>aaaa</div>会显示到zzzzz.html
zzzzz.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
<script type="text/javascript">
window.onload = function(){
document.body.innerHTML = location.hash.substring(1);
};
</script>
</head>
<body>
</body>
</html>
一个框架
把文本域里面的代码显示到框架里面 (就类似一个HTML编译器)当文本域里面的代码是 <a href="http://www.baidu.com">百度</a> 的时候单机按钮框架里面显示的是 百度当我单机这个 百度超链接的时候 框架里的页面会变成百度主页这时候问题来了 我在给文本域随便写入什么代码 单击按钮 框架都不会有反应了 (甚至会报错:无权访问)