473,549 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Turning Javascript off while printing

Hi,

I am building a web page.and have a simple javascript menu... I call
the javascript menu within a div block that my print sytlesheet has
set as a display: none;, well all the content in that block doesn't
show up, EXCEPT the javascript is still getting run...
<div class="menu">
<!--*************** **These lines load in the
menu.********** *************** **-->

<div id='MenuPos' style='position :relative; width:120; height:201;
margin-left:10px'>

<script type='text/javascript'>

//HV Menu v5- by Ger Versluis (http://www.burmees.nl/)

//Submitted to Dynamic Drive (http://www.dynamicdrive.com)

//Visit http://www.dynamicdrive.com for this script and more

function Go(){return}

</script>

<script type='text/javascript' src='/includes/jlc_menu.js'></script>

<script type='text/javascript' src='/includes/menu_com.js'></script>

<noscript>You r browser does not support script</noscript>
</div>

the stuff that doesn't show up when printing, just as it should....
<!-- *End menu*-->
</div>

Any idea how to fix this?

Thanks a bunch!

Jul 23 '07 #1
3 4217
On Jul 22, 9:35 pm, Jlcarroll <jlcarr...@gmai l.comwrote:
Hi,

I am building a web page.and have a simple javascript menu... I call
the javascript menu within a div block that my print sytlesheet has
set as a display: none;, well all the content in that block doesn't
show up, EXCEPT the javascript is still getting run...

<div class="menu">
<!--*************** **These lines load in the
menu.********** *************** **-->

<div id='MenuPos' style='position :relative; width:120; height:201;
margin-left:10px'>

<script type='text/javascript'>

//HV Menu v5- by Ger Versluis (http://www.burmees.nl/)

//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
Oh no.
>
//Visithttp://www.dynamicdriv e.comfor this script and more
For the love of God, don't.
function Go(){return}

</script>

<script type='text/javascript' src='/includes/jlc_menu.js'></script>

<script type='text/javascript' src='/includes/menu_com.js'></script>

<noscript>You r browser does not support script</noscript>
Delete this. It serves no purpose. Better yet, write your menu
without script and then look for a non-invasive menu script.
</div>

the stuff that doesn't show up when printing, just as it should....
<!-- *End menu*-->
</div>

Any idea how to fix this?
The script is going to run regardless of the page's style. What's the
problem (besides the lousy script?) Is it making the menu show up
when the page loads?

Jul 23 '07 #2
oh, I guess that I wasn't clear... I want the script to run on the
screen display, but I want the print display to leave the menu off...
everything in the div block isn't displayed on print, EXCEPT this
bloody menu.

As for a "non-invasive" script... I did this YEARS ago, back before
css even existed... back then I was using tables to do the layout...
ugg ya..., and just finally got around to upgrading to css. But I
haven't gotten around to changing the menu script used... it has
worked fine for me until now. Although I am good at html, I must admit
that I don't know javascript at all, so I don't know what you mean by
invasive or non invasive scripts. Nor do I know how using a different
menu script would help me get it to not run when I am printing the
page.

I am sure that I am doing many things wrong, but I appreciate help
learning to do this right...

Thanks for your help,

James

On Jul 22, 7:48 pm, David Mark <dmark.cins...@ gmail.comwrote:
On Jul 22, 9:35 pm, Jlcarroll <jlcarr...@gmai l.comwrote:
Hi,
I am building a web page.and have a simple javascript menu... I call
the javascript menu within a div block that my print sytlesheet has
set as a display: none;, well all the content in that block doesn't
show up, EXCEPT the javascript is still getting run...
<div class="menu">
<!--*************** **These lines load in the
menu.********** *************** **-->
<div id='MenuPos' style='position :relative; width:120; height:201;
margin-left:10px'>
<script type='text/javascript'>
//HV Menu v5- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)

Oh no.
//Visithttp://www.dynamicdriv e.comforthis script and more

For the love of God, don't.
function Go(){return}
</script>
<script type='text/javascript' src='/includes/jlc_menu.js'></script>
<script type='text/javascript' src='/includes/menu_com.js'></script>
<noscript>You r browser does not support script</noscript>

Delete this. It serves no purpose. Better yet, write your menu
without script and then look for a non-invasive menu script.
</div>
the stuff that doesn't show up when printing, just as it should....
<!-- *End menu*-->
</div>
Any idea how to fix this?

The script is going to run regardless of the page's style. What's the
problem (besides the lousy script?) Is it making the menu show up
when the page loads?

Jul 23 '07 #3
On Jul 22, 7:35 pm, Jlcarroll <jlcarr...@gmai l.comwrote:
Hi,

I am building a web page.and have a simple javascript menu... I call
the javascript menu within a div block that my print sytlesheet has
set as a display: none;, well all the content in that block doesn't
show up, EXCEPT the javascript is still getting run...

<div class="menu">
<!--*************** **These lines load in the
menu.********** *************** **-->

<div id='MenuPos' style='position :relative; width:120; height:201;
margin-left:10px'>

<script type='text/javascript'>

//HV Menu v5- by Ger Versluis (http://www.burmees.nl/)

//Submitted to Dynamic Drive (http://www.dynamicdrive.com)

//Visithttp://www.dynamicdriv e.comfor this script and more

function Go(){return}

</script>

<script type='text/javascript' src='/includes/jlc_menu.js'></script>

<script type='text/javascript' src='/includes/menu_com.js'></script>

<noscript>You r browser does not support script</noscript>
</div>

the stuff that doesn't show up when printing, just as it should....
<!-- *End menu*-->
</div>

Any idea how to fix this?

Thanks a bunch!

The best way to do it is with css. Like this:

<style type="text/css" media=print>
..menuBar{displ ay:none;}
</style>

<style type="text/css">
..menuBar{font-family:Arial;
//all of the rest of the style for your menuBar}
</style>

when you declare the first div for your menu <div class=menuBar>

When sent to the printer, it will see the media is "print" and make
the menu invisable

I hope this helps. I do it on all of my web sites
Jul 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4662
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing File\Print Preview in IE6 and noticed that occasionally the leftmost button of the javascript menu (CoolMenus Version 3.02) on our website is printed. (I...
8
3240
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing File\Print Preview in IE6 and noticed that occasionally the leftmost button of the javascript menu (CoolMenus Version 3.02) on our website is printed. (I...
5
2269
by: TrvlOrm | last post by:
Can any one please help me...I am new to JavaScript and I have been struggling with this code for days now and can't figure it out. I would like to get the Buttons to correspond with the action to either a) generate numbers b) Prompts a user to locate a web page c) go to previous page in history list d) Loads next page in history list e)...
1
8808
by: Bill | last post by:
I strongly suspect that this is not possible but I'll ask anyway. I want to print a web page from javascript. I can use window.print( ) no problem but I also want to be able the control margin widths. I have a script for printing address labels but it is proving difficult to make the addresses appear in the right places. Can I also...
4
2002
by: KenH | last post by:
I have a charting applet that has a print method that works just fine. My problem is I am trying to initiate the print method from a javascript routine but it doesn't work. I access my applet from javascript all the time (feeding data hidden in a form to the chart), but for some reason trying to launch the printing from javascript doesn't...
5
10080
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using System.Drawing; using System.Drawing.Printing; using System.IO;
7
1665
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that delivers loads of report data into custom-named <span> tags on the client, hidden from the screen by @media classes. From a dynamically built menu of what was returned, the user selects wich report...
5
14177
by: fjanon | last post by:
Is there a way to remove the default footer/header from the printed page when printing a page from HTML/Javascript in IE 6? I want to use letterhead paper and I have to remove manually the header/footer from the default printer setting. I know that IE has lots of options/features, I spent a good time on MSDN but could not find anything. ...
16
9271
by: freefony | last post by:
Am trying to parse a php array into javascript but i found that only one element of the array was present in the javascript array. here is my code code <?php include("../../connect.php"); $qry="select * from stock"; $rst=mysql_query($qry) or die("Error in Query.".$qry." ".mysql_error()); while($row=mysql_fetch_assoc($rst)){ $item=$row;...
0
7734
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7979
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1960
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1074
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.