To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-15-2006, 07:15 PM   #1
kralspace
Member
 
Join Date: Nov 2002
Location: central Texas
Posts: 45
[RESOLVED] CSS way to turn off javascript menu in print style sheet?

Just when you think you're finished.......lol



I created a print style sheet for our site that doesn't display banners, icons, etc. and everything works except for not stifling the js menu, it still shows up in printview and prints.

I made this page to post here with just the js links and the 'don't print' style above it that works on everything else. Is there a way to 'turn off' this menu thru CSS? thanks as always, Kathy


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style type="text/css">

#dontprint {
display : none;
}
</style>

</head>
<body>

<div id="dontprint">

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

</div>

<div id="content">
<h1>North Carolina Curriculum Guide</h1>
</div>

</body>
</html>
kralspace is offline   Reply With Quote
Old 02-15-2006, 08:49 PM   #2
JPnyc
Administrator
 
Join Date: Jan 2005
Posts: 963
No, fraid not. Script tags don't have a display property since they don't display.
__________________
PHP builder Online Community Manager

JPnyc is online now   Reply With Quote
Old 02-15-2006, 10:10 PM   #3
kralspace
Member
 
Join Date: Nov 2002
Location: central Texas
Posts: 45
resolved Resolved unfortunately

Thanks jpnyc, I was afraid that would be the answer, I appreciate your time,

onward thru the fog.....

Kathy
kralspace is offline   Reply With Quote
Old 02-17-2006, 06:24 AM   #4
JPnyc
Administrator
 
Join Date: Jan 2005
Posts: 963
I'm trying to think of another way to accomplish this. I suppose if you don't mind using javascript to solve this, it could be done by changing the src attribute of the script tag. I've never tried but I think it might be possible
__________________
PHP builder Online Community Manager

JPnyc is online now   Reply With Quote
Old 02-17-2006, 11:10 AM   #5
kralspace
Member
 
Join Date: Nov 2002
Location: central Texas
Posts: 45
thanks for the thought jpnyc. I've switched over to a php menu to solve the problem today, but I'll try changing the src attribute this weekend on a dummy file.

Are you snowed in up there? thanks, Kathy
kralspace is offline   Reply With Quote
Old 02-17-2006, 05:56 PM   #6
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,124
I'm thinking the problem is elsewhere (perhaps in the .js files) or at least browser-dependent, since the original code works for me in both Firefox and IE6. I also wrote the following to toggle the display property programmatically.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style type="text/css">

#dontprint {
display:block;
}
</style>
<script type='text/javascript'>
function toggle_menu()
{
	that = document.getElementById('dontprint');
	that.style['display'] = (that.style['display']=='none')?'block':'none';
}
</script>
</head>
<body>

<div><input type="button" value="Toggle Visibility" onClick="toggle_menu();">
</div>

<div id="dontprint">
<script type='text/javascript' src='menu.js'></script>
</div>

<h1>North Carolina Curriculum Guide</h1>

</body>
</html>

---------------8<---------------menu.js-------------------
document.write("<select>");
for(i=0;i<10;i++)
	document.write("<option>Option "+i+"</option>");
document.write("</select>");
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
Weedpacket is offline   Reply With Quote
Old 02-17-2006, 07:13 PM   #7
JPnyc
Administrator
 
Join Date: Jan 2005
Posts: 963
Still don't think that'll help. Whether it's display:none or not, the script tag will be printed to the page and it will be parsed.
__________________
PHP builder Online Community Manager

JPnyc is online now   Reply With Quote
Old 02-17-2006, 11:41 PM   #8
bpat1434
NMaOtBG
 
bpat1434's Avatar
 
Join Date: Oct 2004
Location: Around 255.255.255.0
Posts: 8,093
Um.. how about using more than just one CSS element?

Code:
dispaly: none;
visibility: hidden;
hieght: 0px;
content: "";
That should hide just about any menu.....
bpat1434 is offline   Reply With Quote
Old 02-18-2006, 03:15 AM   #9
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,124
Quote:
Originally Posted by JPnyc
Still don't think that'll help. Whether it's display:none or not, the script tag will be printed to the page and it will be parsed.
Yeah, but it won't be displayed, which is what I thought the problem was (at least, it isn't displayed when I try it. Not on the screen, not in print preview, not in actual print.)
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
Weedpacket is offline   Reply With Quote
Old 03-05-2006, 06:29 PM   #10
larry98765
Junior Member
 
Join Date: Mar 2006
Posts: 10
Not sure, but I'll take a crack at this:

First, I'd use a class rather than an id for the dontprint directive like this:

.dontprint {
display: none;
}

Because then you can re-use that in multiple places in your HTML where you'd like items that don't print.

2) Then I would put the <div class='dontprint'> directly into the javascript code (in a document.write or what have you) so that that the div gets output along with the other output that the menu js produces. So instead of wrapping your script tag with the div, you're including the div in your javascript rendering.

Not sure if it'll work, but worth a try!
larry98765 is offline   Reply With Quote
Old 03-05-2006, 09:08 PM   #11
bpat1434
NMaOtBG
 
bpat1434's Avatar
 
Join Date: Oct 2004
Location: Around 255.255.255.0
Posts: 8,093
Gee... isn't that what i said...? lol.

Anyway, did kralspace ever fix this? 'ello?
bpat1434 is offline   Reply With Quote
Old 03-05-2006, 10:45 PM   #12
kralspace
Member
 
Join Date: Nov 2002
Location: central Texas
Posts: 45
Hi guys, thanks for the suggestions. I had to get the site up and running so I bit the bullet and bought a really good CSS book and created the menu that way. I did save copies of my old files and these responses because I really would like to try them out, especially using the class like both you guys suggested. I'm really looking forward to taking a beginners class for programming so I can understand what I'm trying to do a bit better,

air conditioning running on March 6, this is nuts!
thanks and I'll let you know how it goes. Kathy
kralspace is offline   Reply With Quote
Old 03-06-2006, 07:35 AM   #13
JPnyc
Administrator
 
Join Date: Jan 2005
Posts: 963
I think what was suggested above, setting the height and width to 0px, is your best bet. Somehow I suspect IE will bollix it up, but it's worth a try.
__________________
PHP builder Online Community Manager

JPnyc is online now   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 08:41 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.