Display the javascript code of the html page in textarea
Source: Internet
Author: User
I want the html page written in textarea to be displayed as html
I know that tools such as htmledit can't be used. I only need simple display.
1st Floor
You can use document. write ()
If you want to edit it, I think you may still need tools like htmledit. I am studying fckeditor, which has a few types and has fewer functions. Hey, my personal opinion, hope it will be useful to you.
2nd floor
<Textarea id = tx1> </textarea>
<Input type = button value = "show" onclick = "test ();")>
<Script>
Function test ()
{
X = window. open ("about: blank ");
X.doc ument. write (tx1.value );
}
</Script>
Third floor
Display in multi-line text box
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
This function can be used
4th floor
<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>
Use this to replace textarea
5th floor
Up
6th Floor
The html page is not displayed in textarea, but the html page displayed in textarea can be ....
Document. write (xxxxxx)
Xxxxx is the value of your textarea
7 th floor
<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 th floor
This is so troublesome. You can use iframe.
9th floor
You can also edit
10th floor
Friendship up.
11 th floor
<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">
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.