js编辑框 编辑的时候想把内容显示在编辑框文本域里
content_editor.init('${content}');当content等于内容一:
<p>内容一<p>
一切正常当content等于内容二:
<p>内容二<p>
<p>内容二<p>
<p>内容二<p>
错误就是content里面有换行符的时候 报错
请问各位前辈有没有处理过类似问题 该怎么解决我的项目是使用到的相关技术是 springside3 (struts2.0)+ js+ prototype
content_editor.init('${content}');当content等于内容一:
<p>内容一<p>
一切正常当content等于内容二:
<p>内容二<p>
<p>内容二<p>
<p>内容二<p>
错误就是content里面有换行符的时候 报错
请问各位前辈有没有处理过类似问题 该怎么解决我的项目是使用到的相关技术是 springside3 (struts2.0)+ js+ prototype
解决方案 »
- web
- JS如何弹出信息框。。
- 请教javascript与IE7,IE8不兼容问题
- 页面按钮的问题
- 这个身份验证函数怎么没有用?
- 急,当我的输入光标通过某种方式到一输入框(text),我想把输入框中的值选中,那样我想重新输入的话,就不要再按(backspace或delete按钮
- IE5.0 JS 可输入下拉框 clip问题
- 没分了,问一个问题,希望朋友们帮帮..
- 如何用javascript来判断在文本框中输入是ip地址,给出代码,给分28
- easyui的datebox怎么禁用掉(disable)
- 怎么得到这个控件的事件,来做相应的处理?高手来看看,传统方法不能实现。
- 谁能给个zlnherit库。。网上基本搜索不到
现在就是想设 textarea.value 难道弄一个隐藏的div 里面放个textarea 用它的value 值的试下
方法2 该怎么换啊 换行我看在数据库中 他是以换行的格式保存的 没看到 /r/n <br/>之类的 该怎么写呢
<textarea id="x" style="display:block">${content?html}</textarea> //这个是freeer 的写法。其他技术自己处理方法2:
content_editor.init('${content.repalce('\r\n','<br/>').repalce("'","\'")}');freeer 的大致方法/
还是不行啊 我太愚顿了 两种方法都没搞定
<SCRIPT type=text/javascript>
var e_bold = true;
var e_italic = true;
var e_underline = true;
var e_JustifyLeft = true;
var e_JustifyCenter = true;
var e_JustifyRight = true;
var e_InsertUnorderedList=true;
var e_InsertOrderedList=true;
var e_font = true;
var e_fontsize = true;
var e_color = true;
var e_backcolor = true;
var e_img = true;
var e_link = true;
var e_media = true;
var e_audio = true;
var e_uploadimg = true;
var e_piclink = true;
var e_toolbarbg = "#f7f7f7";
content_editor = new webEditor("content_editor" , $("content_div") , 590, 350);
content_editor.init('${content}');
</SCRIPT>
webEditor.prototype.init = function(str)
{
this.getUA();
e_init_content = str;
this.drawEditor();
if(e_isOpera)
{
this.genObj();
this.textArea.value = e_init_content;
return;
}
}webEditor.prototype.drawEditor = function()
{
var htmlstr;
if(e_isOpera)
{
htmlstr = '<div id="'+this.id+'_tid" style="width:'+(this.width+2)+'px;background-color:'+e_toolbarbg+';"></div>'
+'<div id="'+this.id+'_eid" style="border:1px #808080 solid;width:'+this.width+'px;height:'+this.height+'px;"><div class="it1"><iframe id="'+framename+'" name="'+framename+'" style="width:'+(this.width-2)+'px; height: '+(this.height-2)+'px;" frameborder=0 marginwidth=0 scrolling=auto src="/GamePlatform/js/blog/blank.htm" onfocus="javascript:'+this.id+'.iframeOnfocus();" onblur="javascript:'+this.id+'.iframeOnblur();" onload="javascript:'+this.id+'.postInit();"></iframe></div></div>';
}
else
{
var framename = this.id+'_fid_'+(++this.iframeno);
if (this.toolbarpos == "right")
{
htmlstr = '<div id="'+this.id+'_eid" style="float:left;border:1px #808080 solid;width:'+(this.width-50)+'px;height:'+this.height+'px;"><div class="it1"><iframe id="'+framename+'" name="'+framename+'" style="width:'+(this.width-50-2)+'px; height: '+(this.height-2)+'px;" frameborder=0 marginwidth=0 scrolling=auto src="/GamePlatform/js/blog/blank.htm" onfocus="javascript:'+this.id+'.iframeOnfocus();" onblur="javascript:'+this.id+'.iframeOnblur();" onload="javascript:'+this.id+'.postInit();"></iframe></div></div><div id="'+this.id+'_tid" style="float:left;background-color:'+e_toolbarbg+';"></div><div style="clear:both;"></div>';
}
else
{
htmlstr = '<textarea style="font-size:14px;width:'+this.width+'px;height:'+this.height+'px;" id="'+this.id+'_aid" name="'+this.id+'_aid"></textarea>';
}
}
this.editorArea.innerHTML = htmlstr;
}
我写进去就报做啊