日期:2008-08-26 浏览次数:21157 次
前面为大家介绍了文章的在线添加以及保存,但如果仅仅是这样还不够的,因为有很多的文章本身带有的HTM代码必须完整的显示出来,而不是显示出它的效果来,这也就是说必须转化HTM代码以使它能具体显示出它的代码,比如:<a href="">你好</a>你并不想在页面上显示出它是一个连接,而是显示其代码,这就象FrontPage里面的直接在编辑页面写代码,只不过FrontPage提供了转化的功能而已。
  新建一文件articlechar.inc,其具体内容为:
<%
  "Function程序是建立在子程序过程中的成组处理功能上的,是一个独立的程序用来接受自变量以执行一系列的代码语句,以及把处理好的代码语句的结直接返回给用户代码
function HTMLencode2(str)
    dim result
    dim l
    if isNULL(str) then 
       HTMLencode2=""
       exit function
    end if
    l=len(str)
    result=""
dim i
for i = 1 to l
  "对返回的内容进行判定,并对其含有<,>,chr(13),chr(34),&,chr(32),chr(9)进行相应的转化,如chr(13)变为<br>;也就是回车的HTM代码
    select case mid(str,i,1)
           case "<"
                result=result+"<"
           case ">"
                result=result+">"
                   case chr(13)
                result=result+"<br>"
           case chr(34)
                result=result+"""
           case "&"
                result=result+"&"
                   case chr(32)            
                'result=result+" "
                if i+1<=l and i-1>0 then
                   if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9)  then                       
                      result=result+" "
                   else
                      result=result+" "
                   end if
                else
                   result=result+" "                     
&nb