asp自動補全html標簽自動閉合(正則表達式)_ASP教程

      編輯Tag賺U幣

      推薦:asp中提示至少一個參數沒有被指定值 解決方法
      在寫SQL語句的時候,我們經常會調用一些參數,很可能這些參數中有一個沒有被賦值

      復制代碼 代碼如下:www.wf0088.com

      Function closeHTML(strContent)
      Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
      Set re = New RegExp
      re.IgnoreCase = True
      re.Global = True
      arrTags = Array("p", "div", "span", "table", "ul", "font", "b", "u", "i", "h1", "h2", "h3", "h4", "h5", "h6")
      For i = 0 To UBound(arrTags)
      OpenPos = 0
      ClosePos = 0


      re.Pattern = "\<" + arrTags(i) + "( [^\<\>]+|)\>"
      Set strMatchs = re.Execute(strContent)
      For Each Match in strMatchs
      OpenPos = OpenPos + 1
      Next
      re.Pattern = "\</" + arrTags(i) + "\>"
      Set strMatchs = re.Execute(strContent)
      For Each Match in strMatchs
      ClosePos = ClosePos + 1
      Next
      For j = 1 To OpenPos - ClosePos
      strContent = strContent + "</" + arrTags(i) + ">"
      Next
      Next
      closeHTML = strContent
      End Function

      分享:ASP常見的保留字整理(變量與表名注意不能用)
      許多人在編寫程序的時候因為貪圖方便或不小心使用到程式的保留字,有時明明程序沒有錯,就是無法正確執行。您知道有哪些常見的保留字嗎

      來源:模板無憂//所屬分類:ASP教程/更新時間:2013-04-22
      相關ASP教程