HTML Online Editor does not need to know how to use Dreamweaver, use Word to use this editor, which is very practical in the article system or news system requires text editing web programs.
But how do you embed the HTML editor into the web page and how to get the data inside? !
First we assume that we have to call the HTML online editor in a separate page, the file name is gledit.htm.
HTML online editor has two basic call methods
First, use Object calls:
1. How to embed an HTML editor in a web page: We add the following HTML code in need to embed position:
The Object Tags have received data later that the data we have to call the online editor page, the ID is to call Object to get the ID, and then use this ID when you get the data in the editor. Width and Height are the height and width of the editor.
2, how to get the data in the HTML editor: All the content you need to submit We all put it in a form, and use the Object called editor in this form, and we can set a hidden text area (< Textarea name = "content" style = "display: none"> textarea> or ) to temporarily save the data of the HTML online editor when submitted, because ASP or JSP, the content of Object in the form cannot be directly acquired in PHP, so we must obtain data with hidden text area. We copy the contents of the Object to the hidden text area while submitting. The detailed code is as follows:
Function checkform ()
{
Document.form1.content.value = document.form1.doc_html.value;
}
script>
form>
In this way, in the background processing, we can obtain the data of the HTML online editor directly by taking the data of the hidden area Content.
3, how to join the original picture in the text editor to the HTML online editor: First we make the window to upload a picture when you click the button inserted into the picture, we use our own written programs to implement the machine picture to On the server, then we need to record the path of the picture, then write a function in the cursor's html tab by writing a function in the WEB page calling the HTML online editor. Detailed description and code are as follows:
In the editor, we join the event οnclick = "Window.Open ('IMG_UPLOAD.ASP', 'IMG_UPLOAD', 'WIDTH = 481 Height = 190')> We define in the call editor. Insert the function of HTML code to the editor
Function inserthtml (htmlcode)
{
Var win = window.content_html.idEditbox.document;
Window.content_html.idEditbox.focus (); // is the editor gets focus, place the code inserted outside the editor
Win.Selection.createRAnge (). Pastehtml (htmlcode) // Insert HTML code in the position of the cursor
}
script>
In the file that handles upload images, we call the function of the parent window to insert HTML code.
Var src = '<% = "UPLOAD /" & newname% ";
VAR HTMLCODES;
HTMLCODES = " iframe>, this is loaded on page At the time, you can put the content in the database into the HTML online editor.