Advertisement
2002C Complete Applications #10275

EzColorCode - Html Syntax Highlighting

This is an example application that demonstrates Html Syntax Highlighting. It currently Color Codes Html Tags, Html Attributes, Comments, and ASP Tags in different colors. It highlights when a file is opened, when a user types, and when tags are inserted. It also maintains color coding as a user moves the cursor in and out of a tag using the mouse or arrow buttons. It also handles pasting text into a textbox. This application is complete and contains a demostration of every part of the code. Please check out http://www.codearchive.com/home/eric for my other projects.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Upload
<html>
<head>
<TITLE>Getting Employee Info</TITLE>
</head>
<body>
<h1>Employee Info</h1>
<form method="post" action="GetEmpInfo.asp">
Enter the last name of the employee you want to search:
<br><input type=text name="empLastName" size=40 value=<%=Request("empLastName")%> > 
<input type=submit style="width=150" value="Show">
</form>
<hr>
<span>Sample names are: <i>Davolio, Fuller, Buchanan</i></span>
<hr><br>
<% 
  if Request("empLastName") = "" Then Response.End
%>
<% 
  sql1 = "select firstname, lastname, city, hiredate, photo from Employees where "
  sql2 = "lastname='"
  sql3 = Request.Form("empLastName") & "'"
  sql = sql1 & sql2 & sql3
  Set oRS = Server.CreateObject("ADODB.Recordset")
  oRS.CursorLocation = 3
  oRS.Open sql, "DSN=NW"
  SetImageForDisplay oRS("photo"), "ole"
'  oRS.Open "select logo from pub_info where pub_id='0736'", "DSN=PUBS;UID=sa" 
'  SetImageForDisplay oRS("logo"), "gif"
  Set oRS.ActiveConnection = Nothing
%>
<table>
<tr>
<td valign=top><b>Employee:</b><br>
<%=oRS("firstName") %>&nbsp;<%=oRS("lastName") %><br>
<b>from </b> <%=oRS("city") %><br>
<b>hired </b> <%=oRS("hiredate") %><br>
</td>
<td>
<img src="theImg.asp"</img>
</td>
</tr>
</table>
<%
Function SetImageForDisplay(field, contentType)
  OLEHEADERSIZE = 78
 
  contentType = LCase(contentType)
  select case contentType
    case "gif", "jpeg", "bmp"
      contentType = "image/" & contentType
      bytes = field.value 
    case "ole"
      contentType = "image/bmp" 
      nFieldSize = field.ActualSize
      oleHeader = field.GetChunk(OLEHEADERSIZE)
      bytes = field.GetChunk(nFieldSize - OLEHEADERSIZE)
  end select
  Session("ImageBytes") = bytes
  Session("ImageType") = contentType
End Function
%>
</body>
</html>
Original Comments (3)
Recovered from Wayback Machine