PDA

View Full Version : Stop javascript menu showing when printing



leeollie
01-24-2006, 11:09 PM
Hi

I'm using a Dynamic Drive javascript menu created by Ger Versluis.
"Ger Versluis 2000 version 5.411 - 24 December 2001 (updated Jan 31st, 2003 by Dynamic Drive for Opera7)"

I'm wanting to set the javascript menu to not display within my print stylesheet.

I've tried adding a div id="nav" around the javascript within my header and setting it to 'display: none' in my print stylesheet, i.e.

<div id="nav">
<!-- HV menu to configure look at exemplmenu -->
<script type='text/javascript'>
//HV Menu v5.411- by Ger Versluis (http://www.burmees.nl/)

function Go(){return}
</script>
<script type="text/javascript" src="HSW_exmplmenu_var.js" class="nav"></script>
<script type="text/javascript" src="HSW_menu_com.js" class="nav"></script>
<noscript></noscript>
<!-- end HV -->
</div>

I've also tried adding class="nav" within each link above and setting that to display: none.

Neither of these methods are removing the navigation menu when printing.

Can anyone give me any ideas on how to remove the navigation? Here's the test link.

http://www.virtuallee.co.uk/HSW/index.php

Thanks. Much appreciated!
Lee

Twey
01-25-2006, 05:03 PM
<style type="text/css">
@media print {
#nav {
display: none;
}
}
</style>

leeollie
01-26-2006, 01:09 AM
Hi

Thanks for getting back! Your suggestion looks correct, but it's still not working. I've tried all sorts of combinations using div id="nav" and class="nav" within various parts of the javascript code, i.e.

<style type="text/css">
@media print {
.nav {
display: none;
}
}
</style>

<script type="text/javascript" class="nav">
//HV Menu v5.411- by Ger Versluis (http://www.burmees.nl/)

function Go(){return}
</script>
<script type="text/javascript" src="HSW_exmplmenu_var.js" class="nav"></script>
<script type="text/javascript" src="HSW_menu_com.js" class="nav"></script>
<noscript></noscript>

It's still not hiding the javascript menu. Do you think I need to add something to the actual .js file? It really should be as simple as adding a div around the javascript and setting it to display none..not sure why it's not working.

http://www.virtuallee.co.uk/HSW/index.php

Do you have any other ideas?

Thanks v.much.
Lee

jscheuer1
01-26-2006, 11:09 AM
Well, I did a print preview of your page and only the items with the class of 'menuItem' were showing in up in both IE and FF modes in NS8. So, I'd try Twey's idea, which is essentially correct and apply it to this class. Do this either in addition to what you already were using (if that is required to hide other parts of the menu) or alone, ex:


<style type="text/css">
@media print {
#nav, .menuItem {
display: none;
}
}
</style>

saturnprime
01-26-2006, 09:43 PM
Hi Lee, I see its not printing on your page, what worked in the end?

having the same trouble....