设为首页 加入收藏 网站搜索 繁體中文 中国建站网 — 站长资源分享平台

转换html代码子程序

来源:网络收集 作者:佚名 时间:2007-04-25 17:06:03
function htmlencode(str)
    on error resume next
    dim result
    dim l
    if isnull(str) then
       htmlencode=""
       exit function
    end if

    l=len(str)
    result=""
dim i
for i = 1 to l
    select case mid(str,i,1)
           case "<"
                result=result+"<"
           case ">"
                result=result+">"
           case chr(34)
                result=result+"""
           case "&"
                result=result+"&"
           case chr(13)
                result=result+"<br>"
           case chr(9)
                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+" "                     
                end if
           case else
                result=result+mid(str,i,1)
         end select
       next
       if err.number<>0 then err.clear
       htmlencode=result
   end function

Tags:

  • 好的评价 如果您觉得好,就请您
      0%(0)
  • 差的评价 如果您觉得差,就请您
      0%(0)
  • 相关文章
    广告赞助

    文章随便看看 设计素材 建站学院 网页模板 视频教程

    网友评论

    共有 0 位网友发表了评论,得分 0 分,平均 0 分    查看完整评论

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 1分

    内 容:

             通知管理员 验证码: