View Full Version : Printing option on a web page

12-30-2005, 12:35 AM
Dear All

First of all, Hello to all of you, as this is my first time to use this forum:) .

I am designing a web site using Frontpage 2003. I need to make a button or an icon and put it in some pages when you click on it will take you to the printer to print that page. I do not know how to create that, and I will appreciate your help and assistance if you could let me know ho to do it.

Thank you

12-30-2005, 12:42 AM
Welcome to CodingForums.

You can cause the print dialog to come up using javascript. Here is a simple example:

<input type="button" onclick="window.print()" value="Print" id="PrintBtn" />

12-30-2005, 02:10 AM
Thank you so much oracleguy

That is what exactly I have been looking for !
I was wondering if I can put any image as a small icon instead of the text (PRINT) or not?

Thank you

12-30-2005, 09:10 AM
<a href="#" onclick="window.print();return false"><img src="yourimage.jpg" alt="" style="border:0"></a>

12-31-2005, 01:01 AM
Thank you for both of you guys.

The java code I put it on some pages in the web site, but when I open that page which has contain this script a message comes on the screen say ....To help protect security internet explorer has restircted this file from showing active contact that could access your computer click here for option..... and then if your right click on it then you can select an option as it gives you three options. I was worried that it might be like that to give the same message on most of the computers, and I thought that I should ask you for a better idea.

Thank you

01-01-2006, 04:57 AM
Are you testing locally or on a web server? The message should only occur locally but it should go away once the file is on a web server if the script is harmless.

01-01-2006, 09:21 AM
I have been testing it for now, but it will be uploaded on the server later. I was worried that it would be the same when it is uploaded on the server, but as you say that it will go away, then that would be good.

Thank you

01-01-2006, 01:50 PM
You can turn that off by going to Tools > Internet Options > Advanced Tab > Tick Allow active content to run in files on My Computer.

01-01-2006, 04:31 PM
Thank you very much Mark87. That was a great solution for that, because it was annoying every time was comeing up, and I had to click on it and allow it myself.
Thank you