不行,报window.all.idEditbox
不是对象或者为空
不是对象或者为空
解决方案 »
- js 数组初始化问题
- 请问这个JS盖怎么些
- 刚学 javascript 我想实现 fromlist的 多项选择 一下能 加好几个 一下能删除 好几个 的 效果 我的代码在哪改一下呢? 请高手给该一下被?
- 怎么实现在IE播放RMVB?
- location.assign 这个方法是什么意思?????
- extjs4 MVC 模式向function 传参数的问题
- 显示的,用DW行为控制的!(小弟没分了)
- 紧急求助,来者有分,为什么我的.htm页面调用外部的.js文件无效,
- 简单问题,总是搞不好,大家帮我看看!!
- 关于extjs5用panel另外用extjs已经写好的页面,总是加载不进来
- 请问怎样用JavaScript取得name参数(http://localhost/test.aspx?name=ttt)
- 引号问题
如果是iframe用原来的方法没问题
//下面这个焦点定位得不对!可是找不到解决办法
window.content_html.idEditbox.focus();
win.selection.createRange().pasteHTML(htmlCode)但取得的值却出现在在线编辑器的上面去了,而不是应该出现的框中
<script language="javascript">
function CheckForm()
{
document.form1.content.value=document.form1.doc_html.value;
}
</script>
<body onload="document.all.doc_html.value=document.all.content.value">
<form method="post" action="add_news_save.asp" onsubmit="CheckForm()" name="form1">
<object id="doc_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT></object>
<TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70">gfdasjgidaogf<a href="">dfsafds测试</a></TEXTAREA>,
</form>
</body>
</html>http://www.csdn.net/develop/Read_Article.asp?Id=15214这篇文章介绍的编辑是不是有问题?
public_description=new Editorfunction Editor()
{
this.put_html=function(v){target.document.body.innerHTML=v};
this.get_html=function(){return target.document.body.innerHTML};
this.put_text=function(v){target.document.body.innerText=v};
this.get_text=function(){return target.document.body.innerText};
this.get_doc=function(){return target.document};
}
但是在线编辑器的js很大下载地址
http://www.linxo.net/club/topic.cgi?forum=13&topic=9我需要的是编辑,也就是从服务器取得值后显示给页面
这一部分请使用我上面的测试代码
<iframe id=idEditbox></iframe>
<script>idEditbox.document.designMode="on";</script>
<html>
<script>
function insertHtml(htmlCode)
{ var win=window.content_html.idEditbox.document;
window.content_html.idEditbox.focus();
win.selection.createRange().pasteHTML(htmlCode)}
</script>
<body >
<IFRAME SRC=edit.htm id=content_html width=100% height=400></IFRAME>
<textarea style=display:none name=CCONTENT rows=10 cols=70>hsh<b>jgjkh</b>gkjghhf</textarea>
<IMG style=display:none onload="javascript:insertHtml(document.all.CCONTENT.value)" src="http://www.csdn.net/csdn.gif"></body>
</html>
<iframe id=idEditbox></iframe>
<script>
idEditbox.document.designMode="on";public_description=new Editorfunction Editor()
{
this.insertHTML=function(htmlCode){
idEditbox.focus();
idEditbox.document.selection.createRange().pasteHTML(htmlCode)
};
}</script>scriptlet版
<html>
<script>
function insertHtml(htmlCode)
{window.content_html.insertHTML(htmlCode)
}
</script>
<body >
<object id="content_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT></object> <textarea style=display:none name=CCONTENT rows=10 cols=70>hsh<b>jgjkh</b>gkjghhf</textarea>
<IMG style=display:none onload="javascript:insertHtml(document.all.CCONTENT.value)" src="http://www.csdn.net/csdn.gif"></body>
</html>
object还报错。
object没提示错误,但是不显示内容<html>
<body onload="document.all.doc_html.value=document.all.content.value">
<object id="doc_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT></object>
<TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70">测试1<a href="">测试2</a></TEXTAREA>
</body>
</html>
<script >
function insertHtml(htmlCode)
{
var win=window.content_html.idEditbox.document;
window.content_html.idEditbox.focus();
win.selection.createRange().pasteHTML(htmlCode)
}
</script>
<BODY onload="insertHtml(document.all.CCONTENT.value)">
<IFRAME SRC=edit.htm id=content_html width="50%" height="50%"></IFRAME>
<TEXTAREA style="display:none" NAME="CCONTENT">测试1<a href="">测试2</a></TEXTAREA>
</body>
</html>