'**************************************
' Name: Print this page script
' Description:The code enables you to si
' ngle out a section of your page for prin
' ting by enclosing it in two tags.
' By: Peter Graves
'
' Inputs:The URL to the page you want pr
' inted
'
' Returns:A nice, printable page
'
' Side Effects:Non that I know of.
'
'This code is copyrighted and has
' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=7994&lngWId=4
'for details.
'**************************************
<%
option explicit
'---------------------------------------
' ----------------------------------------
' -------
' Title : Print This Page Script
' Function: To print a section of a page
'
' In : Page URL (?ref=)
' Out: Formatted page for prining
' By: Peter Graves (ICQ - 116613728)
'
' Example : /print/thisscript.asp?ref=ht
' tp://www.myweb.com/mypage.asp
'
' Notes : Could probably be improved, bu
' t for now it works
'
' To use : In your documents that you wa
' nt to print wrap the content in
' <sp> and </sp>
'---------------------------------------
' ----------------------------------------
' -------
Dim RefPage, objXMLHTTP, HTMLPage
RefPage = Request.QueryString("ref")
if Len(RefPage) = 0 or Not Left(RefPage,7) = "http://" Then
response.write "<H1>Invalid reference page - " & RefPage & "</H1>"
response.end
End if
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", RefPage, False
objXMLHTTP.Send
HTMLPage = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
%>
<HTML>
<HEAD>
<TITLE><%=GetPageTitle(HTMLPage)%></TITLE>
<LInk href="/include/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY onLoad="JavaScript:print();">
<%=GetPageBody(HTMLPage)%>
<%=RefPage%>
</BODY>
</HTML>
<%
function GetPageBody(HTMLstring)
Dim tag1, tag2, temp1, temp2
tag1 = "<sp>"
tag2 = "</sp>"
temp1 = Split(HTMLstring,tag1)
if Not uBound(temp1) = 1 Then
Response.Write "An Error Occured - please notify the webmaster about this page - " & RefPage
response.end
End if
temp2 = Split(temp1(1),tag2)
if Not uBound(temp2) = 1 Then
Response.Write "An Error Occured - please notify the webmaster about this page - " & RefPage
response.end
End if
GetPageBody = temp2(0)
End function
function GetPageTitle(HTMLstring)
Dim tag1, tag2, temp1, temp2
tag1 = "<TITLE>"
tag2 = "</TITLE>"
temp1 = split (HTMLstring, tag1)
temp2 = split (temp1(1), tag2)
GetPageTitle = temp2(0)
End function
%>