JavaScript code for displaying HTML pages in textarea _ form effects

Source: Internet
Author: User
Tags chr
I want to have HTML pages written in textarea appear as HTML
I know there's htmledit and stuff like that, and I can't use that much of his functionality. I just need a simple display.
1 floor
If you are only for display, you can use document.write ()
If you want to edit, I think you may still want to use tools such as Htmledit, I am now studying FCKeditor, he has several types, there is less function. Hey, personal see, hope to be useful to you.
2 floor
<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 floor
Display in multiline text boxes
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 (Ten) & CHR (10))
fstring = Replace (fstring, "<BR>", CHR (10))
Deal = fstring
End Function
Use this function to
4 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= "M" >
<param name= "Snaptogridy" value= "M" >
<param name= "UseDivOnCarriageReturn" value= "-1" >
</OBJECT>
Use this instead of textarea.
5 Floor
Up
6 floor
displaying HTML pages in TextArea is not possible, but it's OK to display them as HTML pages in textarea ....
document.write (XXXXXX)
XXXXX is the value of your textarea
7 Floor
<textarea id= "test" rows= "cols=" ></textarea>
<script language= "JavaScript" >
var oimg=document.createelement ("IMG");
Oimg.src= "yun_qi_img/";
Test.appendchild (OIMG);
</Script>
8 Floor
So much trouble, just use an IFRAME.
9 Floor
You can also edit
10 Floor
Friendship up.
11 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 ">
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.