Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:53
Functions to hide menu while printing no longer work
Poster: Marc-Andre.Roberge __at__ mus.ul
Dated: Thursday December 4 2003 - 14:56:37 GMT
Back in the time of version 3, Andy or someone who is very knowledgeable suggested using the following code to cause the menu to disappear briefly while the print command is issued in order to prevent printing problems. I thus inserted the following code in the page:
Code:
</script>
<script type="text/javascript" language="JavaScript"><!--
function hide_menu(mnu){
mn=getMenuByName(mnu)
SDiv("menu"+mn,0)
}
function show_menu(mnu){
mn=getMenuByName(mnu)
SDiv("menu"+mn,1)
}
//--></script>
<script type="text/javascript" language="JavaScript"><!--
function hide_menu(mnu){
mn=getMenuByName(mnu)
SDiv("menu"+mn,0)
}
function show_menu(mnu){
mn=getMenuByName(mnu)
SDiv("menu"+mn,1)
}
//--></script>
The page also includes a "Easy printing" link:
Code:
<a href='javascript:hide_menu("mainmenu");self.print();show_menu("mainmenu")'>Impression facile</a>
Now, with version 5 (RC28), clicking on the link does absolutely nothing and returns the message "Error on the page". Does this happen because the "mainmenu" parameter passed to the functions is no longer valid? If so, what should it be?
I may also simply decide to delete the functions because the printing problem I had at the time seems to have disappeared. In fact, issuing the printing command in IE6 (PC) caused this application to generate a temporary printing file containing all the contents of my menu and submenus to be included, and this locked my HP LaserJet 2200d.
One printing problem remains, however, when printing pages using the Milonic menu, it happens that the last line of text is truncated vertically, i.e., the top part appears at the bottom of the page, and the rest goes at the top of the next page. I have seen this elsewhere once in a while, but is there a way to prevent this from happening?
Poster: kevin3442
Dated: Tuesday December 16 2003 - 0:56:41 GMT
You could try replacing your show_menu() and hide_menu() function definitions with the following:
Code:
function show_menu(menuName)
{
popup(menuName);
}
function hide_menu(menuName)
{
menuDisplay(getMenuByName(menuName), 0);
}
{
popup(menuName);
}
function hide_menu(menuName)
{
menuDisplay(getMenuByName(menuName), 0);
}
Your "Easy Printing" links should then work as they did in the past, assuming that your main menu is still named "mainmenu".
Another option: since Milonic menus now let you apply css styles directly, you could (in theory) use Media Type definitions to prevent the menu from printing. This would have the advantage of letting the user print from a link or using the browser's native print function. Disadvantage would be that it won't work in older browsers that don't support media types. I haven't actually tried this myself, but as I said, it should work.
Kevin