Writing a JavaScript Error Message

The writeError subroutine accepts a number, description, source, and Response object as parameters. The code combines these parameters (except the Response object) into a message and creates a string that contains client-side JavaScript. The message string is inserted into the script, and the Write method of the Response object writes the script to the browser. An alert displays the message.

sMsg = source & ": error " & Hex(number) & "\n" & description & "\n"
   sMsg = Replace(sMsg, "'", "\'") ' so javaScript isn't confused
   oResponse.Write "<" & "script language=""JavaScript"">" & vbCrLf & _
                  "alert('" & sMsg & "');" & vbCrLf & _
                  "</" & "script>"