How can I hide my popup menus when I print my page?
Return to Recent Questions
Q:
Can I use javascript to get the object ID (getElementByID). If not how
do I hide my popup menus when I print the page?
A:
You can add a new button to print your page and call onClick event, so
you should write:
<body ....
onClick="document.getElementById('dm0m0').style.visibility='hidden'; window.print();">
...
</body>
Or you can use the same javascript code from your menu item.
For example:
var menuItems = [
["Print", "javascript:document.getElementById('dm0m0').style.visibility='hidden';
window.print();", icon1, icon2],
];
But if you want to hide the popup menus when your customers push "File/Print"
you should write so:
Create two functions, for example:
function myprint()
{ document.getElementById('dm0m0').style.visibility='hidden';
window.print();
}
function myprint2()
{ document.getElementById('dm0m0').style.visibility='visible';
window.print();
}
You should add this functions into your code.
And then you must write the following code:
window.onbeforeprint = myprint;
window.onafterprint = myprint2;
Return to Recent Questions
Related:
- March 16, 2009 - Is there any way to keep a menu con css lit up when going to another page?
- Aug 31, 2009 - Is it possible to create a javascript expand that will float when I scroll down the page.
- Sep 14, 2009 - We have errors in the scroll down menu when we use two scroll down menu on the one page.
- Oct 22, 2009 - Is there a way to set a menu item to pressed when a page is reloaded?
- Oct 25, 2009 - The first item of the horizontal navigation menu stays highlighted when I load my page.
- Dec 04, 2009 - Will the menus vertical stay in view when the user scrolls page down?
- Jan 23, 2010 - Is it possible set a pressed item when you have multiple dhtml context menu on the page?
- April 29, 2010 - I want the drop down menu generator to hide when I click somewhere else on the screen.
- May 3, 2010 - How can I hide my navigation menu on print?
- June 20, 2010 - Set a menu item of the vertical flyout menu v to pressed when a page is loaded.
|