PDA

View Full Version : Printing Receipt Page - Handy Javascript Trick


harlequin
13-Nov-2003, 06:38 AM
hi everyone, i found this neat trick at http://javascript.internet.com/messages/print-page-auto.html

that automatically pops up a little box when someone hits your receipt page asking if they would like to print the page....

it works neatly

one thing to remember is that if you are adding it to an existing <body> tag, you need to do it this way..

existing actinic body tag,

<body NETQUOTEVAR:BGIMAGE "NETQUOTEVAR:ONLOAD" NETQUOTEVAR:BGCOLOR text="NETQUOTEVAR:FGCOLOR" NETQUOTEVAR:LINKCOLOR NETQUOTEVAR:VLINKCOLOR NETQUOTEVAR:ALINKCOLOR>

and they tell you to insert

<BODY OnLoad="printPage()">

now because you already have a body tag there, you would naturally think that simply cutting out their OnLoad="printPage()" and pasting it into your actinic <body NETQUOTE etc> tag would be sufficient but you need to add a semi colon to seperate it from your existing onload statements from actinic

OnLoad= printPage();

so.... the proper way to add it to the actinic example above would be

<body OnLoad= printPage(); NETQUOTEVAR:BGIMAGE "NETQUOTEVAR:ONLOAD" NETQUOTEVAR:BGCOLOR text="NETQUOTEVAR:FGCOLOR" NETQUOTEVAR:LINKCOLOR NETQUOTEVAR:VLINKCOLOR NETQUOTEVAR:ALINKCOLOR>

we used to just make a print window hyperlink out of the word print...

hurrah for well thought of javascrips...

steve quinn
harlequin domains
www.harlequindomains.com
0800 0832077
Actinic Design, Hosting and Search Engine Optimisation

Steven Barkess
04-Mar-2004, 07:46 PM
Hi Steve

Just found your post re printing...

which file is this in, i have looked in order phase 3 and 4 but cannot find it.

Cheers
Steven

harlequin
04-Mar-2004, 08:13 PM
if you open actinic, and go to Design>Options> and choose the layout 'tab', you can see where it asks you which template to use for the receipt page, if you type in Act_ReceiptPrimary.html , and then click the edit button next to it....the correct page to add the code to (Act_ReceiptPrimary.html) opens up in notepad or your own editor.

hope this helps..

best,

steve q.

Steven Barkess
04-Mar-2004, 11:05 PM
Hi Steve

THanks for that. Unfortunately id does not seem to work, the page loads but at the bottom left on the status bar it says error.

I have played around with the layout, but have not touched any thing more than that...

I've attached my code, any chance you can take a quick look...

Cheers
Steve

nick UK
04-Mar-2004, 11:21 PM
Hi Steve I have just checked through your attached file and I cannot see the printpage function in the page anywhere, is this in one of the JS includes or have you forgotten to add this to the page?

Nick

Steven Barkess
04-Mar-2004, 11:39 PM
hi nick

this is within my attached file...

<BODY onLoad= printPage(); NETQUOTEVAR:BGIMAGE OnLoad="NETQUOTEVAR:ONLOAD" NETQUOTEVAR:BGCOLOR TEXT="NETQUOTEVAR:FGCOLOR" NETQUOTEVAR:LINKCOLOR NETQUOTEVAR:VLINKCOLOR NETQUOTEVAR:ALINKCOLOR marginwidth="5" marginheight="5">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
.....

or am is missing something

Steve

nick UK
04-Mar-2004, 11:43 PM
Yes you are missin the javascript function. Use this link on te first post on this thread and copy the function cose with the <script></script> tags and put them in the <head></ead> tags on your page and then it should work.

Nick

nick UK
04-Mar-2004, 11:48 PM
Here you go I have modified your file so its ready to use.

Nick

Steven Barkess
04-Mar-2004, 11:54 PM
sweet, works a treat now.

dont suppost it is possible to customise the pop up so instead of saying microsoft internet explorer it says my company name at the top

any other neat little things you want to mention...

thanks nick

Steve

Steven Barkess
05-Mar-2004, 08:39 PM
Hello

Following on from yesterday... I notice that it adds to the page at the very top "Free JavaScripts provided by...."

I appreciate that it is free, and that I am using it without giving any thing back, but, I am trying to create a professional looking site. I feel that if this is the first thing that is displayed, it will cheapen the overal site.

Is it possible to disable this message. I guess if it is not, while it is a sweet function, I'll have to take it out.

Hmm

Steve

Steven Barkess
05-Mar-2004, 08:44 PM
AAARRRGGGHHHH I am such a cod.

Just noticed further down

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>


I have now removed this and it is all good.

Steve

nick UK
05-Mar-2004, 08:44 PM
Steve did you use the attachment I put up last night?