473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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>Your 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 4203
On Jul 22, 9:35 pm, Jlcarroll <jlcarr...@gmail.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.dynamicdrive.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>Your 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...@gmail.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.dynamicdrive.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>Your 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...@gmail.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.dynamicdrive.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>Your 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{display: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
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...
8
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...
5
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...
1
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...
4
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...
5
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...
7
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...
5
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...
16
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");...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.