|
| |
|
|
Valaire
Posts: 99 From: New York Status: offline
|
A Hyperlink that Prints - 8/23/2002 12:50:06
Hi, I had posted this in another forum, but it might be relevant to this one, so I' m reposting it... Basically what I want to do is have a link that takes you to another page and automatically prints that page, at the same time. The only thing slightly complicated is that the URL is a page variable derived from an asp script. I was told to use the LINK element in the HEAD, but I am having no luck... this is the code I have now... the LINK in the head, the ASP script that determines the URL, and the hyperlink: <link rel=alternate media=print href=" ../Database/Print/externalprint.asp" >
<%
Dim PrintID, Form
Form = " External Power"
PrintID = Request.Form(" ID" )
If PrintID <> VBNULLString Then
URL = " ../Database/Print/externalprint.asp?ID="
URL = URL & PrintID
Else
Session(" DB" ) = Form
URL = " ../Database/Print/printerror.asp"
End If
%>
<a href=" <%=URL%>" ><img border=" 0" src=" ../Images/Sidebar/new(w).jpg" ></a> I just cut out those 3 parts, they' re not actually in order like that. The link element is in the head section, and the rest is in the body.
< Message edited by valaire -- 8/22/2002 12:51:09 PM >
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: A Hyperlink that Prints - 8/23/2002 13:00:12
Valarie, On the page that you want to print, place the following code at the very top of the page: <SCRIPT TYPE=" text/javascript" > <!-- function printme() { window.print() } //--> </SCRIPT> Now locate the line in your code (on the page you want to print) that says: <body> Change it to say: <body onload=" printme()" > This will print the page automatically when the page loads in. Good luck
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: A Hyperlink that Prints - 8/23/2002 13:40:18
Bobby, I tested it at the beginning of the page. I guess it really doesn' t matter where you put it as long as it' s there. Yes, an " If... then..." would allow Valarie the option of choosing whether to print the page or not. Good point!!! The code I provided I prefer to connect to a button myself.
_____________________________
|
|
|
|
Valaire
Posts: 99 From: New York Status: offline
|
RE: A Hyperlink that Prints - 8/23/2002 13:47:59
Thanks fellas, trying them out now. :) -- Works like a charm.
< Message edited by valaire -- 8/22/2002 1:52:00 PM >
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: A Hyperlink that Prints - 8/24/2002 11:06:22
Ahhhhhhhhhhhhh so true!!!
_____________________________
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|