当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 在textarea中显示html页面的javascript代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 在textarea中显示html页面的javascript代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 169 ::
收藏到网摘: n/a

我想让textarea中写的html页面显示为html形式
我知道有htmledit之类的工具 我用不了他的那么多的功能 我只要简单的显示就可以了
1楼
如果你只为显示的话,可以用document.write()
如果还要编辑的话,我觉得你可能还是要用htmledit之类的工具,我现在在研究fckeditor,他有几中类型,有功能少的。嘿嘿,个人之见,希望对你有用。
2楼
<textarea id=tx1></textarea>
<input type=button value="show" onclick="test();")>
<script>
function test()
{
x=window.open("about:blank");
x.document.write(tx1.value);
}
</script>
3楼
在多行文本框中显示
function Deal(fString)
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString," ",chr(32))
fString = Replace(fString,""",chr(34))
fString = Replace(fString,"'",chr(39))
fString = Replace(fString, "", CHR(13))
fString = Replace(fString, "</P><P>", CHR(10) & CHR(10))
fString = Replace(fString, "<BR>", CHR(10))
Deal = fString
end function
用此函数可以
4楼
<OBJECT class=EditorArea id=objContent classid=clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A viewastext>
<PARAM NAME="ActivateApplets" VALUE="0">
<PARAM NAME="ActivateActiveXControls" VALUE="0">
<PARAM NAME="ActivateDTCs" VALUE="-1">
<PARAM NAME="ShowDetails" VALUE="0">
<PARAM NAME="ShowBorders" VALUE="-1">
<PARAM NAME="Appearance" VALUE="1">
<PARAM NAME="Scrollbars" VALUE="-1">
<PARAM NAME="ScrollbarAppearance" VALUE="1">
<PARAM NAME="SourceCodePreservation" VALUE="-1">
<PARAM NAME="AbsoluteDropMode" VALUE="0">
<PARAM NAME="SnapToGrid" VALUE="0">
<PARAM NAME="SnapToGridX" VALUE="50">
<PARAM NAME="SnapToGridY" VALUE="50">
<PARAM NAME="UseDivOnCarriageReturn" VALUE="-1">
</OBJECT>
用这个代替 textarea
5楼
up
6楼
将html页面显示在textarea中显示不会,不过将textarea中的显示为html页面倒是可以的....
document.write(xxxxxx)
xxxxx为你的textarea的值
7楼
<textarea id="test" rows="20" cols="50"></textarea>
<Script Language="JavaScript">
var oImg=document.createElement("IMG");
oImg.src="http://www.51js.com/images/avatars/14.gif";
test.appendChild(oImg);
</Script>
8楼
这么麻烦,用iframe不就行了
9楼
也可以编辑
10楼
友情up。
11楼
<div style="width:300px;height:100px;border:1px solid red;" contenteditable=true id="aa">
</div>
<input type=button onclick="aa.innerHTML ='<font color=green>asdfs</font>'" value="set">