上次那个页面写入的问题是我没有表达清楚意思我说的重新可以写入的页面是 写入代码到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();
解决方案 »
- 求文字替换的正则
- 如何编写javascript库
- 如何输出 alert("\upload\");
- 请教:正则replace问题!如一个字符串"aaabbcc",想替换bb为其他如kk,用replace正则怎么做?
- 打印网页时,怎样在程序中取得当前页码(&p)和总页数(&P)呢?在线等,解决立即结贴!
- Textarea中如何模拟翻页效果 点input键Textarea翻屏.在线等.回答就加分
- 很简单!
- 页面form中有几个checkbox,在提交之后如何自动保存用户的选择,即将用户选中的checkbox默认选中。
- 大家來來看看!!在iframe中我怎樣才能改變主頁面里值, 如表格的某個間元格!!!
- 请问Combox中选中的文字如何取出来??
- js调用dll的问题 急!!! 在线等!!!
- 用Dojo 做控件遇到一个问题?希望大家帮忙解答?
你的意思是想在那个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> 的时候单机按钮框架里面显示的是 百度当我单机这个 百度超链接的时候 框架里的页面会变成百度主页这时候问题来了 我在给文本域随便写入什么代码 单击按钮 框架都不会有反应了 (甚至会报错:无权访问)