css and js question about hiding div

M

middletree

I'm doing an ASP-built Intranet app, and am having trouble with a bit
of
code on the menu I am using. I got it from some free site, but I tried
emailing the person whose email address is in the code, but that email
addy
doesn't work anymore.

Since it's Intranet, I put an HTML version on the web for you to look
at.
The links won't work, of course. Address is
http://www.middletree.net/T16155.htm

What I want to do is make a print.css so that when it is printed, the
menu
will be invisible. If you look at my code, you'll see that there is a
main
css file, and a print one, called print.css. I need to put something in
there which tells the divs which contain the menu to be hidden.
However, I
have not been able to figure out what those divs are called. I have
pored
through your JavaScript code, but just cannot figure this out.

Please note that I cannot simply say div {display:none;}, as there are
divs
in the bottom part for that hide-show stuff, and they need to remain
unaffected by this.
 
M

Michael Winter

[snip]
What I want to do is make a print.css so that when it is printed, the
menu will be invisible. If you look at my code, you'll see that there is
a main css file, and a print one, called print.css. I need to put
something in there which tells the divs which contain the menu to be
hidden.

Ah, good 'ol HVMenu. I'm glad this is only for an intranet. It has no
business existing on the Web.
However, I have not been able to figure out what those divs are called.
I have pored through your JavaScript code, but just cannot figure this
out.

At present, the DIVs aren't given ids. That makes the first few rules in
your print stylesheet meaningless, I believe.

Using the DOM Inspector supplied with Firefox, I managed to track down the
relevant part of the code you need to modify:

Open menu_com.js and find the Go function (about a fifth of the document
down). There are two blocks that begin

if(FrstCreat){

Move to the second one which contains the call to CreateMenuStructure.
After that call, add

FrstCreat.id = '...';

replacing the ellipsis with whatever you want for an id. This now
identifies the outermost DIV. You can now remove it with

#menu-id {
display: none;
}

[snip]

Good luck,
Mike
 
M

Michael Winter

You can speficy style rules with more granularity than just attaching
them to tag names.

The problem here is that the script doesn't supply anything specific to
use in selectors. The only recourse is to alter the script first, then add
some appropriate CSS. See my other post.

[snip]

Mike
 
M

mt

Thanks for this. I understood that it was a matter of finding the selector
and adding an id to it, but I couldn't for the life of me figure out where
in the code to do that.

The advice I got seemed logical, but didn't work.

Here's the changed code:
if(FrstCreat){FrstCntnr=CreateMenuStructure('Menu',NoOffFirstLineMenus);
FrstCreat.id = 'noPrint';
FrstCreat=(AcrssFrms)?0:1}
else CreateMenuStructureAgain('Menu',NoOffFirstLineMenus);

And in the print.css, I put
#noPrint {display: none;}
..noPrint {display: none;}


Perhaps I put that create id code in the wrong place?
 
M

Michael Winter

[snip]
Perhaps I put that create id code in the wrong place?

Nuts. Sorry, I wrote the wrong identifier. It should have been:

FrstCntnr.id = '...';

That is, the variable that is assigned the result of CreateMenuStructure.

Mike
 
M

mt

YESSSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!!!

You have no idea how much time I put into this! Thanks big time!

Now, you say the menu I got is badly coded, and I realize that more now than
I did when I first started building this thing. I am tempted to go to
ProjectSeven.com and build a new menu from there to replace this one. But if
you have any others that meet the criteria of (a) free (b) easily
manipulatable by people like me with little JS understanding, I'd appreciate
hearing about it.

But even if you don't, you have done me a great service today. Thanks very
much!


Michael Winter said:
[snip]
Perhaps I put that create id code in the wrong place?

Nuts. Sorry, I wrote the wrong identifier. It should have been:

FrstCntnr.id = '...';

That is, the variable that is assigned the result of CreateMenuStructure.

Mike
 
M

Michael Winter

[snip]
Thanks big time!

You're welcome.
Now, you say the menu I got is badly coded, and I realize that more now
than I did when I first started building this thing.

Absolutely.

- 23KBs+ is far too large for a single script.
- The source is pretty much impossible to navigate, and that wasn't
intentional.
- There is no provision at all for navigation when scripting is
disabled.
- Disabling CSS produces something unrecognisable as a navigation
aid.
- Uses browser detection.

I might be forgetting something...
I am tempted to go to ProjectSeven.com and build a new menu from there
to replace this one.

The menu on the home page seems well-written to a point, but it doesn't
lineralise well with scripting disabled. Moreover, $90? No thanks.
But if you have any others that meet the criteria of (a) free (b) easily
manipulatable by people like me with little JS understanding, I'd
appreciate hearing about it.

For the moment, the only ones I'm happy to recommend are present in an
article on Netscape's DevEdge website. Although DevEdge is now dead, you
can still access the article with the Wayback Machine:
<URL:http://web.archive.org/web/20040202080126/devedge.netscape.com/viewsource/2003/devedge-redesign-js/>.
There are two other menus linked in the conclusion.

[snip]

Mike


Please don't top-post.
 
M

mt

Michael Winter said:
The menu on the home page seems well-written to a point, but it doesn't
lineralise well with scripting disabled. Moreover, $90? No thanks.

What's lineralise mean? Can't find that in any help file or doc.

And I was talking about the free Swap Class extension and tutorial that are
on the P7 site. I guess 90 bucks would be worth it to be able to build a
menu through a GUI, because of the time is saves.
For the moment, the only ones I'm happy to recommend are present in an
article on Netscape's DevEdge website. Although DevEdge is now dead, you
can still access the article with the Wayback Machine:
<URL:http://web.archive.org/web/20040202080126/devedge.netscape.com/viewsour
ce/2003/devedge-redesign-js/>.

thanks
 
M

Michael Winter

[snip]
The menu on the home page seems well-written to a point, but it doesn't
lineralise well with scripting disabled. Moreover, $90? No thanks.

What's lineralise mean?

In one draft of my reply I did describe what I meant there. Obviously I
deleted that.
Can't find that in any help file or doc.

You won't, but basically what I was trying to describe is how the menu
looks when it's not in its intended state. When scripting is disabled (or
enabled but doesn't provide the necessary functionality), the menu
displays as one, long linear list. There's nothing obvious, like
indentation, to signify where the various sub-menus begin and end.
And I was talking about the free Swap Class extension and tutorial that
are on the P7 site.

Well, you never said that. :p
I guess 90 bucks would be worth it to be able to build a menu through a
GUI, because of the time is saves.

All you're doing is creating a set of nested unordered lists. That part
isn't complicated at all. You're paying for (in my opinion) the rather
over-priced effort they made.

[snip]

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top