css and js question about hiding div

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • middletree

    #1

    css and js question about hiding div

    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


    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.

  • Michael Winter

    #2
    Re: css and js question about hiding div

    On 19 Nov 2004 13:36:47 -0800, middletree <middletree@gma il.com> wrote:

    [snip]
    [color=blue]
    > 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.[/color]

    Ah, good 'ol HVMenu. I'm glad this is only for an intranet. It has no
    business existing on the Web.
    [color=blue]
    > 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.[/color]

    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 CreateMenuStruc ture.
    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

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • ExGuardianReader

      #3
      Re: css and js question about hiding div

      middletree wrote:[color=blue]
      > 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.[/color]

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

      You can specify rules for certain /classes/ (
      http://www.w3.org/TR/html4/struct/gl...tml#adef-class ) of tags...



      Comment

      • Michael Winter

        #4
        Re: css and js question about hiding div

        On Sat, 20 Nov 2004 18:55:24 +0000 (UTC), ExGuardianReade r
        <noway@noway.co m> wrote:
        [color=blue]
        > middletree wrote:
        >[color=green]
        >> 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.[/color]
        >
        > You can speficy style rules with more granularity than just attaching
        > them to tag names.[/color]

        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

        --
        Michael Winter
        Replace ".invalid" with ".uk" to reply by e-mail.

        Comment

        • mt

          #5
          Re: css and js question about hiding div

          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){F rstCntnr=Create MenuStructure(' Menu',NoOffFirs tLineMenus);
          FrstCreat.id = 'noPrint';
          FrstCreat=(Acrs sFrms)?0:1}
          else CreateMenuStruc tureAgain('Menu ',NoOffFirstLin eMenus);

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


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


          Comment

          • Michael Winter

            #6
            Re: css and js question about hiding div

            On Sat, 20 Nov 2004 16:10:38 -0600, mt <middletree@HTO mail.com> wrote:

            [snip]
            [color=blue]
            > Perhaps I put that create id code in the wrong place?[/color]

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

            FrstCntnr.id = '...';

            That is, the variable that is assigned the result of CreateMenuStruc ture.

            Mike

            --
            Michael Winter
            Replace ".invalid" with ".uk" to reply by e-mail.

            Comment

            • mt

              #7
              Re: css and js question about hiding div

              YESSSSSSSSSSSSS SSSSSSS!!!!!!!! !!!!!!!!!!!!!

              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.co m 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" <M.Winter@bluey onder.co.invali d> wrote in message
              news:opshsavlaa x13kvk@atlantis ...[color=blue]
              > On Sat, 20 Nov 2004 16:10:38 -0600, mt <middletree@HTO mail.com> wrote:
              >
              > [snip]
              >[color=green]
              > > Perhaps I put that create id code in the wrong place?[/color]
              >
              > Nuts. Sorry, I wrote the wrong identifier. It should have been:
              >
              > FrstCntnr.id = '...';
              >
              > That is, the variable that is assigned the result of CreateMenuStruc ture.
              >
              > Mike
              >
              > --
              > Michael Winter
              > Replace ".invalid" with ".uk" to reply by e-mail.[/color]


              Comment

              • Michael Winter

                #8
                Re: css and js question about hiding div

                On Sat, 20 Nov 2004 16:22:50 -0600, mt <middletree@HTO mail.com> wrote:

                [snip]
                [color=blue]
                > Thanks big time![/color]

                You're welcome.
                [color=blue]
                > 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.[/color]

                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...
                [color=blue]
                > I am tempted to go to ProjectSeven.co m and build a new menu from there
                > to replace this one.[/color]

                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.
                [color=blue]
                > 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.[/color]

                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.netscap e.com/viewsource/2003/devedge-redesign-js/>.
                There are two other menus linked in the conclusion.

                [snip]

                Mike


                Please don't top-post.

                --
                Michael Winter
                Replace ".invalid" with ".uk" to reply by e-mail.

                Comment

                • mt

                  #9
                  Re: css and js question about hiding div


                  "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                  news:opshs46azv x13kvk@atlantis ...[color=blue][color=green]
                  > > I am tempted to go to ProjectSeven.co m and build a new menu from there
                  > > to replace this one.[/color]
                  >
                  > 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.[/color]

                  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.[color=blue]
                  > 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:
                  >[/color]
                  <URL:http://web.archive.org/web/200402020...e.com/viewsour
                  ce/2003/devedge-redesign-js/>.

                  thanks


                  Comment

                  • Michael Winter

                    #10
                    Re: css and js question about hiding div

                    On Sun, 21 Nov 2004 12:13:16 -0600, mt <middletree@HTO mail.com> wrote:
                    [color=blue]
                    > "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                    > news:opshs46azv x13kvk@atlantis ...[/color]

                    [snip]
                    [color=blue][color=green]
                    >> 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.[/color]
                    >
                    > What's lineralise mean?[/color]

                    In one draft of my reply I did describe what I meant there. Obviously I
                    deleted that.
                    [color=blue]
                    > Can't find that in any help file or doc.[/color]

                    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.
                    [color=blue]
                    > And I was talking about the free Swap Class extension and tutorial that
                    > are on the P7 site.[/color]

                    Well, you never said that. :P
                    [color=blue]
                    > I guess 90 bucks would be worth it to be able to build a menu through a
                    > GUI, because of the time is saves.[/color]

                    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

                    --
                    Michael Winter
                    Replace ".invalid" with ".uk" to reply by e-mail.

                    Comment

                    Working...