Recommended: Date calculation questions about ASP Returns the date when the specified time interval has been added. DateAdd(interval, number, date) Parameter interval Required. A string expression that indicates the time interval to be added. For values, see the Settings section. number Required option. Numeric expression, indicating the number of time intervals to be added. Numeric expressions can be positive (get future dates) or negative (
HTML online editor does not need to know how to use Dreamweaver. If you know how to use Word, you can use this editor. It is very practical in web programs that require text editing in article systems or news systems.
But how to embed the html editor into the web page and how to obtain the data inside? !
First, we assume that the HTML online editor we want to call is placed in a separate page, and the file name is gledit.htm.
There are two basic calling methods for HTML online editor
1. Use object to call:
1. How to embed the html editor in the web page: We add the following html code to the location we need to embed: <object id=doc_html data=gledit.htm width=530 height=320 type=text/x-scriptlet VIEWASTEXT></ object>
The data we have to call the data in the object tag is the path we have to call the online editor page, and the id is the id we have to call the object to get the id. This id is used when we get the data in the editor later. Width and height are the height and width of the editor.
2. How to obtain the data in the html editor: We put all the contents that need to be submitted in a form, and the editor called using object is also placed in this form. At the same time, we can set a hidden text area (< textarea name=content style=display:none></textarea> or <INPUT TYPE=hidden name=content>) is used to temporarily save the data of the html online editor when submitting, because it cannot be directly in asp or jsp and php Get the content of the object in the form, so we must use the hidden text area to get the data. While submitting the form, we copy the contents in the object to the hidden text area. The detailed code is as follows:
<script language=javascript>
function CheckForm()
{
document.form1.content.value=document.form1.doc_html.value;
}
</script>
<form method=post action=add_news_save.asp onsubmit=CheckForm() name=form1>
<object id=doc_html name= doc_html style=LEFT: 0px; TOP: 0px data= gledit.htm width=530 height=320 type=text/x-scriptlet VIEWASTEXT></object>
<input type=hidden name=content >
</form>
In this way, in the background processed page, we can directly obtain the data of the html online editor by getting the data of the hidden area content.
3. How to add uploading native pictures to the html online editor in the text editor: First, we make a window to upload the image pop up when clicking the button to insert the image. We use the program we wrote to achieve uploading native pictures to On the server, we need to record the path of the picture, and then add the html tag that displays the picture through the value of the html online editor. The detailed description and code are as follows:
In the editor, we add the event onclick=window.open('img_upload.asp','img_upload','width=481 height=190')>In 'img_upload.asp', we will submit Upload the picture to the server to create a directory and record the image path
<script language=javascript>
var src='<%=upload/&newname%>';
opener.form1. doc_html.value +=<img border=0 src=+src+>;
window.close();
</script>
This enables simple insertion of uploaded images into the editor.
4. How to call the HTML online editor to modify data when editing articles: When we add the HTML online editor to modify data when adding it to the database, we also need to be able to use the HTML online editor to edit the database content. to modify the data. First, we add a hidden area to the form to place the content in the database, for example <TEXTAREA style=display:none NAME=content ROWS=20 COLS=70><%= rs(Content)%></TEXTAREA>, please pay attention to it Here we use hidden textarea instead of hidden input, because the data may contain carriage return and line breaks, so if we use <INPUT TYPE=hidden name=content value=<%=(rs(Content)%>>It is very likely that an HTML error occurs because <%=(rs(Content)%> has a new line (value=The data followed must be guaranteed to be on one line, otherwise an error will occur). According to the method introduced above, use object to call the HTML online editor. The method and code are the same as above. What we need to do now is actually the inverse process when submitting. We just need to copy the content of the hidden text area to the HTML online editor. Here we add <body onload=document.form1. doc_html.value=document.form1.content.value> to the body, so that when the page is loaded, the content in the database can be placed into the HTML online editor to edit it. , the submission process is the same as the one introduced above, and I will not go into details here.
2. Use iframe calls (some duplicates of object calls are briefly described)
1. How to embed in a web page: We add the following html code to the location we need to embed: <IFRAME SRC=gledit.htm id='content_html' style=LEFT: 0px; POSITION: absolute; TOP: 0px;z-index: 0 width=100% height=100%></IFRAME> where src= is followed by data is what we want to call the online editor page to get the path, id is what we call IFRAME to get the id, Width and height are the editor height and Width is already.
2. How to obtain the data in the html editor: Similarly, we put all the contents that need to be submitted in a form, and we can set a hidden text area (<textarea name=content style=display:none></textarea > or <INPUT TYPE=hidden name=content>) is used to temporarily save the data of the html online editor when submitting. We use the hidden text area to obtain the data. While submitting the form, we copy the contents in the object to the hidden text area. The detailed code is as follows:
function subchk(cmd)
{
document.form1.content.value= window.content_html.getHTML();
}
</SCRIPT>
<FORM METHOD=POST ACTION=Article_add_save.gl name=form1 onsubmit= subchk()>
<input type=hidden name=content >
Share: ASP summary of the page cache clearing method Every time I go to Chinaasp, many netizens always ask how to refresh the Asp page. Under the management of IIS4, the problem of not refreshing the page is much more serious than that of IIS5, and sometimes some statements that control page cache still do not work. I'm not very clear about the reason, go and ask Microsoft:-) Now I will summarize some methods of clearing page cache as follows: 1. Add at the beginning of the Asp page