How can I hide my menu html code 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 menu html code 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 menu html code 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 effective website navigation lit up when going to another page?
- March 23, 2009 - My menu html code doesn't work on IE6. No rollovers, no drop downs.
- Apr 10, 2009 - I can not figure out how to fix the menu html code from going off the page in Mozilla...
- Apr 27, 2009 - Does your license for menu html code need to be tied to a domain name to work?
- May 15, 2009 - We want to set a specific width for each top level item in the menu html code
- May 31, 2009 - Is there a way submenu's to be the same for first and second level in menu html code
- Jun 18, 2009 - The background images is missing in menu html code
- Jul 05, 2009 - My menu html code submenu is not display at the correct position with Firefox.
- Jul 23, 2009 - I can't see menu html code on my test page only direct links...
- Aug 08, 2009 - If a user selects menu html code in the upper frame he get the menu html code that is in the content frame...
- Aug 26, 2009 - I want to change the menu html code item link text from status bar messages to another value?
|