This article describes how to display the html source code written to the database in the form of html source code on the page, this is a function in asp. Today, the html source code written to the database is displayed on the page in the form of html source code, rather than being interpreted by the browser .. After finding N for a long time, I don't know how to do it. then I can see that a program has the function of modifying the template .. I found a method named asp ^ and noted it down.
Server. HTMLEncode
HTMLEncode
1. the HTMLEncode method applies HTML encoding to the specified string.
Syntax
Server. HTMLEncode (string)
Parameters
String
Specifies the string to be encoded.
Example
Script
The code is as follows:
<% = Server. HTMLEncode ("The paragraph tag:
") %>
Output
The paragraph tag:
Note that the above output will be displayed
The paragraph tag:
If you look at the source file or open a Web page in text mode, you can see the encoded HTML
II. Analysis of related examples:
Rs ("content") = Server. Htmlencode (Request ("content ")):
Rs ("content") indicates that rs is a recordset object, and content is a field in the database table. The recordset object can operate each record in the database table, and each field.
Server. Htmlencode: converts some code into html format.
Request ("content") refers to the value of an element named content in the previous returned page. it may be a text box in the form, it may also be something of the querystring type.
But judging from the name and habits, it is a multi-line text box of a form, because it is used for content placement.
It puts the value in the text box sent from the previous submission page in the content field of the currently opened record in the database.