请问:当把iframe变成编辑器时,想调看iframe上面的东西,那句怎么写? 谢谢!<iframe id=write></iframe>
<input type=submit onclick=ok() value=sub ><script>
editor=document.getElementById("write");
editor=editor.contentWindow.document;
editor.designMode = "on";
function ok(){
alert(editor上面的内容); //这句怎么写?
}
</script>
<input type=submit onclick=ok() value=sub ><script>
editor=document.getElementById("write");
editor=editor.contentWindow.document;
editor.designMode = "on";
function ok(){
alert(editor上面的内容); //这句怎么写?
}
</script>
解决方案 »
- JQ动态给SELECT第N个元素添加点击事件
- 关于使用innerHTML替换的问题(在线等.....)
- 编码问题,请高手指点
- (来者均有分)关于如何隐藏JavaScript代码的问题-在线急
- 求介绍一本asp.net MVC3及JavaScript用于提高的书籍,现在感觉入门了但是不知道该往哪个方向发展了。
- clipboardData.getData("Text");
- javascript可以做这样的随机抽题吗?
- 如何用程序控制打印纸张的设置?
- 关于object的自动排序问题
- 如何用jquery简写下面的javascript代码
- 晕了 自己ajax的一个页面 里面的<script>中的里面有"字符串" 导致无法执行 请问怎么办?
- 变量调用问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<textarea id="TextArea1" cols="20" rows="2"></textarea>
</body>
</html>
外层页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<script type="text/javascript">
function getiframe(){
var tiframe=document.getElementById("tiframe");
alert(tiframe.contentDocument.getElementById("TextArea1").value);
alert(tiframe.contentDocument.body.innerHTML);
}
</script>
</head>
<body>
<table>
<tr>
<td><iframe id="tiframe" src="test.htm" width="400" height="300" frameborder="1" scrolling="auto"></iframe></td>
</tr>
<tr>
<td><input id="Button1" type="button" value="button" onclick="getiframe();" /></td>
</tr>
</table>
</body>
</html>