加亮显示ASP文章原代码 - ASP Source code

加亮显示ASP文章原代码 - ASP Source code,第1张

概述<%@ LANGUAGE= VBSCRIPT %><% Option Explicit %><% 'file: CodeBrws.asp 'Overview: This formats and writes the text of the selected page for ' the View Script Button 'This file is provi... <%@ LANGUAGE="VBSCRIPT"  %>
<% Option Explicit %>
<%
    'file:        CodeBrws.asp
    'OvervIEw:    This formats and writes the text of the selected page for
    '            the VIEw Script button  
    'This file is provIDed as part of the Microsoft Visual Studio 6.0 Samples

    'THIS CODE AND informatION IS PROVIDED "AS IS" WITHOUT
    'WARRANTY OF ANY KIND,EITHER EXpressed OR IMPLIED,
    'INCLUDING BUT NOT liMITED TO THE IMPLIED WARRANTIES
    'OF MERCHANTABIliTY AND/OR fitness FOR A  PARTIculaR
    'PURPOSE.

    'copyright (C) 1997,1998 Microsoft Corporation,All rights reserved
%>
<HTML>

<head>
<Meta name="DESCRIPTION" CONTENT="ASP Source code browser">
<Meta name="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
<Meta http-EQUIV="Content-Type" CONTENT="text/HTML; charset=iso8859-1">
<Title></Title>
</head>

<body BGcolor="#FFFFFF" topmargin="0" leftmargin="0" Alink="#23238E" Vlink="#808080"
link="#FFCC00">
<baseFont FACE="VERDANA,ARIAL,HELVETICA" SIZE="2"><!--- disPLAY THE color LEGEND --->


<table border="1">
  <tr>
    <td WIDTH="25" BGcolor="#FF0000">&nbsp;&nbsp; </td>
    <td><Font FACE="VERDANA,HELVETICA" SIZE="2">ASP Script</Font> </td>
  </tr>
  <tr>
    <td BGcolor="#0000FF">&nbsp;&nbsp; </td>
    <td><Font FACE="VERDANA,HELVETICA" SIZE="2">Comments</Font> </td>
  </tr>
  <tr>
    <td BGcolor="#000000">&nbsp;&nbsp; </td>
    <td><Font FACE="VERDANA,HELVETICA" SIZE="2">HTML and Text</Font> </td>
  </tr>
</table>

<hr>
<Font FACE="VERDANA,HELVETICA" SIZE="2"><% OutputSource %>
</Font>
</body>
</HTML>
<%
  Sub OutputSource
    Dim strVirtualPath,strfilename
    strVirtualPath = Request("Source")
    strfilename = Server.MapPath(strVirtualPath)
    
    Dim fileObject,oInStream,strOutput
    'Creates a file object to hold the text of the selected page
    Set fileObject = CreateObject("Scripting.fileSystemObject")
    Set oInStream = fileObject.OpenTextfile(strfilename,1,0)
    'Loop that writes each line of text in the file according to
    'the Printline function below
    While NOT oInStream.AtEndOfStream
      strOutput = oInStream.Readline
      Call Printline(strOutput,fCheckline(strOutput))
      Response.Write "<BR>"
    Wend
  End Sub

  ' Returns the minimum number greater than 0
  ' If both are 0,returns -1
  Function fMin(iNum1,iNum2)
    If iNum1 = 0 AND iNum2 = 0 Then
      fMin = -1
    ElseIf iNum2 = 0 Then
      fMin = iNum1
    ElseIf iNum1 = 0 Then
      fMin = iNum2
    ElseIf iNum1 < iNum2 Then
      fMin = iNum1
    Else
      fMin = iNum2
    End If
  End Function

  Function fCheckline (ByVal strline)
  Dim iTemp,iPos
  fCheckline = 0
  iTemp = 0
  
  iPos = InStr(strline,"<" & "%")
  If fMin(iTemp,iPos) = iPos Then
    iTemp = iPos
    fCheckline = 1
  End If
  
  iPos = InStr(strline,"%" & ">")
  If fMin(iTemp,iPos) = iPos Then
    iTemp = iPos
    fCheckline = 2
  End If
  
  iPos = InStr(1,strline,"<" & "SCRIPT",1)
  If fMin(iTemp,iPos) = iPos Then
    iTemp = iPos
    fCheckline = 3
  End If
  
  iPos = InStr(1,"<" & "/SCRIPT",iPos) = iPos Then
    iTemp = iPos
    fCheckline = 4
  End If
  
  iPos = InStr(1,"<" & "!--",iPos) = iPos Then
    iTemp = iPos
    fCheckline = 5
  End If
  
  iPos = InStr(1,"-" & "->",iPos) = iPos Then
    iTemp = iPos
    fCheckline = 6
  End If
  
  End Function

  Sub PrintHTML (ByVal strline)
    Dim iPos,iSpaces,i
    iSpaces = Len(strline) - Len(LTrim(strline))
    i = 1
    'Correct for tabs
    While MID(Strline,i,1) = Chr(9)
      iSpaces = iSpaces + 5
      i = i + 1
    Wend
    'Insert spaces
    If iSpaces > 0 Then
      For i = 1 to iSpaces
        Response.Write("&nbsp;")
      Next
    End If
    iPos = InStr(strline,"<")
    If iPos Then
      Response.Write(left(strline,iPos - 1))
      Response.Write("&lt;")
      strline = Right(strline,Len(strline) - iPos)
      Call PrintHTML(strline)
    Else
      Response.Write(strline)
    End If
  End Sub

  Sub Printline (ByVal strline,iFlag)
    Dim iPos
    Select Case iFlag
      Case 0
        Call PrintHTML(strline)
      
      Case 1
        iPos = InStr(strline,"<" & "%")
        Call PrintHTML(left(strline,iPos - 1))
        Response.Write("<Font color=#ff0000>")
        Response.Write("&lt;%")
        strline = Right(strline,Len(strline) - (iPos + 1))
        Call Printline(strline,fCheckline(strline))
      
      Case 2
        iPos = InStr(strline,"%" & ">")
        Call PrintHTML(left(strline,iPos -1))
        Response.Write("%&gt;")
        Response.Write("</Font>")
        strline = Right(strline,fCheckline(strline))
      
      Case 3
        iPos = InStr(1,1)
        Call PrintHTML(left(strline,iPos - 1))
        Response.Write("<Font color=#0000ff>")
        Response.Write("&lt;SCRIPT")
        strline = Right(strline,Len(strline) - (iPos + 6))
        Call Printline(strline,fCheckline(strline))
      
      Case 4
        iPos = InStr(1,"<" & "/SCRIPT>",iPos - 1))
        Response.Write("&lt;/SCRIPT&gt;")
        Response.Write("</Font>")
        strline = Right(strline,Len(strline) - (iPos + 8))
        Call Printline(strline,fCheckline(strline))
      
      Case 5
        iPos = InStr(1,iPos - 1))
        Response.Write("<Font color=#0000ff>")
        Response.Write("&lt;!--")
        strline = Right(strline,Len(strline) - (iPos + 3))
        Call Printline(strline,fCheckline(strline))
      
      Case 6
        iPos = InStr(1,iPos - 1))
        Response.Write("--&gt;")
        Response.Write("</Font>")
        strline = Right(strline,Len(strline) - (iPos + 2))
        Call Printline(strline,fCheckline(strline))
      
      Case Else
        Response.Write("Function Error -- Please contact the administrator.")
    End Select
  End Sub
%>
总结

以上是内存溢出为你收集整理的加亮显示ASP文章原代码 - ASP Source code全部内容,希望文章能够帮你解决加亮显示ASP文章原代码 - ASP Source code所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1220106.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存