How can I hide my drop down menu on print?
Return to Recent Questions
Q:
Can I use javascript to get the object (getElementByID). If not how
do I hide my drop down menu on print?
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 menu when your customers push "File/Print"
you should write so:
You must 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 so:
window.onbeforeprint = myprint;
window.onafterprint = myprint2;
Return to Recent Questions
Related:
- March 25, 2009 - My drop down menu is fixed like a rock. It doesn't float.
- Apr 11, 2009 - I cannot see the shadow on the top items in my drop down menu example.
- Apr 28, 2009 - There is some bug with your drop down menu and Page Zoom function in IE7.
- May 16, 2009 - The alignment of the submenus is not correct in my drop down menu.
- Jun 01, 2009 - Is there any functionality for tree drop down menu to show/hide specific branches?
- Jun 19, 2009 - Will this drop down menu rollout from an Iframe over a regular frame
- Jul 06, 2009 - I can not find in DHTML Tuner how to make drop down menu multi-level or multi-column
- Jul 24, 2009 - I would like to use this drop down menu in a page containing two iFrames.
- Aug 09, 2009 - Is it possible to keep my floating drop down menu in the centre of the page like <centre></centre>
- Aug 27, 2009 - Is this drop down menu compatible under Linux?Drop down menu Linux Firefox Support
- Sep 13, 2009 - There is a gray line under the drop down menu images that makes it look broken.
|