473,597 Members | 2,138 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 4221
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
4668
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 have wrapped the javascript that generates this menu in a DIV so that it is concealed from...
8
3243
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 have wrapped the javascript that generates this menu in a DIV so that it is concealed from...
5
2272
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) Promps the user for a URL and loads the web page in a new window f) and Re-Sizes the window. ...
1
8814
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 issue a form feed from within the html page? I have tried to use char(12) but that seems to be ignored
4
2006
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 work. Any ideas? Do I have to set some kind of focus?
5
10102
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
1670
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 they want to view/print and a little jscript .innerHTML magic happens under the hood that copies...
5
14180
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. TIA Fred
16
9280
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; $list=$row; }
0
7965
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
5847
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2399
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
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.