I posted this question: (I am using VSD 5.9.4)
Can't anyone out there help with this?
I need to print a page but don't want the print button on the page to print with it.........how do I make this happen. This is my 2nd post......several views but no help on my 1st post.......someone must know how to do this. I host with Lunarpages and don't know much at all about css.
Thanks in advance for any help.
Your Reply Cliff:
The only way I know how to hide anything from the printer is with .css
I'm afraid there is little to find (back when I was looking for it) on the net on this topic that is not complicated or a long process, so I made my own simple code to handle it.
The .css file is simply this:
body {visibility:visible;}
.print {visibility:hidden;}
And I save that (and only that on the page) as print.css
Next, you use some code to let your page know that you are using that .css file. Put this in between the <head> </head> tags on your web page.
<link rel="stylesheet" href="print.css"
type="text/css" media="print" />
The last part is to call the code into play, around whatever you want not to print. The print button code could look like this:
<div align="center" class="print"><form><input type="button" value=" Print this page "
onclick="window.print();return false;" /></form> </div>
You could also have sections of the page that do not print by using the same technique:
<div class="print">This text will not print on the page, as long as you are using the print.css file</div>
Let me know if this works for you. I have been using it for at least 3 years with no trouble.
Please pardon my lack of knowledge.
1st....is this the correct way to reply to your reply?
2nd....I have a page that when pulled up causes a popup with a coupon and a print button which is simply another normally inaccessable page on my site.
When you say:
The only way I know how to hide anything from the printer is with .css
I'm afraid there is little to find (back when I was looking for it) on the net on this topic that is not complicated or a long process, so I made my own simple code to handle it.
The .css file is simply this:
body {visibility:visible;}
.print {visibility:hidden;}
And I save that (and only that on the page) as print.css
.....exactly how do I make a file and where do I save it to? And on what page do I save it? I assume the page with the coupon and print button. Do I use notepad for instance or can I just hide it on the page itself?
When you say:
Next, you use some code to let your page know that you are using that .css file. Put this in between the <head> </head> tags on your web page.
<link rel="stylesheet" href="print.css"
Do I.............click edit....then edit header .....then insert? Or do I use HTML tool and put in head section? And again, on which page.....the page with the print button?
When you say:
The last part is to call the code into play, around whatever you want not to print. The print button code could look like this:
<div align="center" class="print"><form><input type="button" value=" Print this page "
onclick="window.print();return false;" /></form> </div>
.......Where do I put this? My print code looks like this:
<form><input type="button" value=" Print Coupon "
onclick="window.print();return false;" /></form>
My popup code looks like this:
In body using HTML tool: <!-- Script Size: 1.27 KB -->
in head using HTML tool: <HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup() {
url = "Test_Page.html";
width = 616; // width of window in pixels
height = 288; // height of window in pixels
delay = 2; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
</script>
Again..........thanks in advance for your patiance
A question for Cliff Main....my main...
your best way to reply is simply to add another post after my reply in the same thread. There is a box at the bottom that says "Post Information". Just type in what you need to say and click on the "Add My Reply" button. That way, you won't be starting a new thread everytime you reply. Hope that helps.
Ok, for the .css file.
Use notepad. Take an empty page and save the css stuff I told you to save, and give the file the name print.css
The down side is that you need to upload that 'print.css' file to your server. If you don't have an ftp program, CoffeeCup (I think) has a free ftp program. That is a program that lets you upload files other than your Visual Site Designer files to your server. You may also have a 'Control Panel' from your web server that can upload files.
Upload the print.css file to the same folder in your website where your other pages are found.
You need to add the
<link rel="stylesheet" href="print.css" />
code to the <head> of the page you have your print button in. For some reason, in what you copied there was missing the />, make sure you have that in case it was my typo.
Now, when you add the print button to the page, you use a 'class' to tell the page that you are using the print.css file to control what gets printed..that needs to be on the same page as your <link rel="stylesheet" href="print.css" /> code for it to work.
<div class="print"><form><input type="button" value=" Print Coupon "
onclick="window.print();return false;" /></form></div>
you need to be able to save and updoad those files to where your website pages are for it to work.
Please reply at the bottom and click the "Add My Reply" button to continue so we don't have to re-type everyting.
Ok, for the .css file.
Use notepad. Take an empty page and save the css stuff I told you to save, and give the file the name print.css
The down side is that you need to upload that 'print.css' file to your server. If you don't have an ftp program, CoffeeCup (I think) has a free ftp program. That is a program that lets you upload files other than your Visual Site Designer files to your server. You may also have a 'Control Panel' from your web server that can upload files.
Upload the print.css file to the same folder in your website where your other pages are found.
You need to add the
<link rel="stylesheet" href="print.css" />
code to the <head> of the page you have your print button in. For some reason, in what you copied there was missing the />, make sure you have that in case it was my typo.
Now, when you add the print button to the page, you use a 'class' to tell the page that you are using the print.css file to control what gets printed..that needs to be on the same page as your <link rel="stylesheet" href="print.css" /> code for it to work.
<div class="print"><form><input type="button" value=" Print Coupon "
onclick="window.print();return false;" /></form></div>
you need to be able to save and updoad those files to where your website pages are for it to work.
Please reply at the bottom and click the "Add My Reply" button to continue so we don't have to re-type everyting.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
www.mainsites.ca is my website, and yes, some of it is crappy.
I forgot, you probably need the html tool to add the line of code in the <head> add code here </head> tags. I am not as familiar with VSD as I should be. Add it to the pop-up page, if you created it in vsd. If the pop-up comes from lunarpages, you might have to contact them to see if any code can be added to their page.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
www.mainsites.ca is my website, and yes, some of it is crappy.
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.