程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> ASP技巧 >> 將ASP的Debug變得簡單的兩個函數

將ASP的Debug變得簡單的兩個函數

編輯:ASP技巧

<%
'---------------------------------------------------------------------------
'                   程序作用:打印request.form輸入的所有值
'---------------------------------------------------------------------------
Response.Write FormData()
    function FormData()
     Dim llngMaxFIEldIndex
     Dim llngFIEldIndex
     Dim llngMaxValueIndex
     Dim llngValueIndex
     Dim lstrDebug
     ' Count Form
     llngMaxFIEldIndex = Request.Form.Count
    
     ' Let user know if Form Do Not exist
     if llngMaxFIEldIndex = 0 Then
      FormData = "Form data is empty."
      Exit function
     End if
    
     ' Begin building a list of all Form
     lstrDebug = "<OL>"
    
     ' Loop through Each Form
     For llngFieldIndex = 1 To llngMaxFIEldIndex
      lstrDebug = lstrDebug & "<LI>" & Server.HtmlEncode(Request.Form.Key(llngFIEldIndex))
     
      ' Count the values
      llngMaxValueIndex = Request.Form(llngFIEldIndex).Count
     
      ' if the FIEld doesn't have multiple values ...
      if llngMaxValueIndex = 1 Then
       lstrDebug = lstrDebug & " = "
       lstrDebug = lstrDebug & Server.HtmlEncode(Request.Form.Item(llngFIEldIndex))
      ' Else Loop through Each value
      Else
       lstrDebug = lstrDebug & "<OL>"
       For llngValueIndex = 1 To llngMaxValueIndex
        lstrDebug = lstrDebug & "<LI>"
        lstrDebug = lstrDebug & Server.HtmlEncode(Request.Form(llngFIEldIndex)(llngValueIndex))
        lstrDebug = lstrDebug & "</LI>"
       Next
       lstrDebug = lstrDebug & "</OL>"
      End if
      lstrDebug = lstrDebug & "</LI>"
     Next
     lstrDebug = lstrDebug & "</OL>"
     ' Return the data
     FormData = lstrDebug
    
    End function

%>

<%
'-------------------------------------------------------------------------
'           函數功能:輸出所有輸入request.querystring值,用於調試!
'-------------------------------------------------------------------------

   Response.Write QueryStringData()
    function QueryStringData()
     Dim llngMaxFIEldIndex
     Dim llngFIEldIndex
     Dim llngMaxValueIndex
     Dim llngValueIndex
     Dim lstrDebug
     ' Count QueryString
     llngMaxFIEldIndex = Request.QueryString.Count
    
     ' Let user know if QueryString Do Not exist
     if llngMaxFIEldIndex = 0 Then
      QueryStringData = "QueryString data is empty."
      Exit function
     End if
    
     ' Begin building a list of all QueryString
     lstrDebug = "<OL>"
    
     ' Loop through Each QueryString
     For llngFieldIndex = 1 To llngMaxFIEldIndex
      lstrDebug = lstrDebug & "<LI>" & Server.HtmlEncode(Request.QueryString.Key(llngFIEldIndex))
     
      ' Count the values
      llngMaxValueIndex = Request.QueryString(llngFIEldIndex).Count
     
      ' if the FIEld doesn't have multiple values ...
      if llngMaxValueIndex = 1 Then
       lstrDebug = lstrDebug & " = "
       lstrDebug = lstrDebug & Server.HtmlEncode(Request.QueryString.Item(llngFIEldIndex))
      ' Else Loop through Each value
      Else
       lstrDebug = lstrDebug & "<OL>"
       For llngValueIndex = 1 To llngMaxValueIndex
        lstrDebug = lstrDebug & "<LI>"
        lstrDebug = lstrDebug & Server.HtmlEncode(Request.QueryString(llngFIEldIndex)(llngValueIndex))
        lstrDebug = lstrDebug & "</LI>"
       Next
       lstrDebug = lstrDebug & "</OL>"
      End if
      lstrDebug = lstrDebug & "</LI>"
     Next
     lstrDebug = lstrDebug & "</OL>"
     ' Return the data
     QueryStringData = lstrDebug
    
    End function

%>

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved