Printevenlig hovedpine
Hej alle!Jeg sidder og fumler med et ASP-script, som kan lave en printevenlig side ved hjælp af HTTP_REFERER.... Indtil videre har det kun givet mig grå hår i hovedet, hovedpine, og begyndende mavesår....
Det kører på min hjemmeserver: http://80.196.148.230/theme/printpage.asp
Mit problem er at jeg får en kompileringsfejl ved linien
<% option explicit %>
hele scriptet ser således ud:
----------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<% @Language=VBScript %>
<% option explicit %>
<% dato=now() %>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://80.196.148.230/theme/ou_print.css">
<title>print<title>
</head>
<body>
<table class="hovedbox" width="560">
<tr>
<td width="100%">
<table width="100%" height="184">
<tr>
<td class="hovedtekst" width="100%" colspan="3" height="105">
<img border="0" src="http://80.196.148.230/theme/print_banner.jpg" width="555" height="100"></td>
</tr>
<tr>
<td class="hovedtekst" width="30%" height="15"><% Response.Write dato %></td>
<td class="hovedtekst" width="55%" height="15"><% Request.ServerVariables("HTTP_REFERER") %> </td>
<td class="hovedtekst" width="15%" height="15"><a href="java script:window.print();">
<img border="0" src="http://80.196.148.230/theme/print.gif" width="16" height="16">Print Siden</a></td>
</tr>
<tr>
<td class="hovedindhold" width="100%" colspan="3">
<%
Const ForReading = 1
Dim strReferrer, objFSO, objOpenFile, strLine
strReferrer = Request.QueryString("REF")
If Len(strReferrer) > 1 then
strReferrer = Request.ServerVariables("HTTP_REFERER")
If Len(strReferrer) < 1 then
Response.Write "Egad! An Error occurred! We could not" & _
" determine what page you wanted to view the source for..."
Response.End
Else
'With the HTTP_REFERER, the entire URL is passed along... we
'need to hack out the part
strReferrer = Right(strReferrer,len(strReferrer)-7)
strReferrer = Right(strReferrer,len(strReferrer) - _
instr(1,strReferrer,"/")+1)
End If
End If
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objOpenFile = objFSO.OpenTextFile(Server.MapPath(strReferrer), - _
ForReading)
'Output each line of the file...
Do Until objOpenFile.AtEndOfStream
strLine = objOpenFile.ReadLine
Response.Write strLine & vbCrLf
Loop
objOpenFile.Close
Set objOpenFile = Nothing
Set objFSO = Nothing
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>