changing specific <div> status

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

    changing specific <div> status

    I have <div id=box1 style="display: block"as the initial setting.
    I need to change the "display:bl ock" to "display:no ne" then back to
    "display:bl ock" as a means of clearing anything that might be
    displayed within the box1 division.

    What's the simplest way of doing this?
  • rf

    #2
    Re: changing specific &lt;div&gt; status


    "richard" <member@newsguy .comwrote in message
    news:cob5h45s5r aiea8621kf1m17j 4gmf4inlf@4ax.c om...
    >I have <div id=box1 style="display: block"as the initial setting.
    I need to change the "display:bl ock" to "display:no ne" then back to
    "display:bl ock" as a means of clearing anything that might be
    displayed within the box1 division.
    Changing the display property as above will *not* achieve "clearing anything
    that might be displayed".


    Comment

    • richard

      #3
      Re: changing specific &lt;div&gt; status

      On Thu, 06 Nov 2008 09:09:06 GMT, "rf" <rf@invalid.com wrote:
      >
      >"richard" <member@newsguy .comwrote in message
      >news:cob5h45s5 raiea8621kf1m17 j4gmf4inlf@4ax. com...
      >>I have <div id=box1 style="display: block"as the initial setting.
      >I need to change the "display:bl ock" to "display:no ne" then back to
      >"display:block " as a means of clearing anything that might be
      >displayed within the box1 division.
      >
      >Changing the display property as above will *not* achieve "clearing anything
      >that might be displayed".
      >
      As I have found out this is true.
      So what will?

      Comment

      • rf

        #4
        Re: changing specific &lt;div&gt; status


        "richard" <member@newsguy .comwrote in message
        news:chd5h4l2u9 cgqa76ak4ct3fst l0tnl1k9t@4ax.c om...
        On Thu, 06 Nov 2008 09:09:06 GMT, "rf" <rf@invalid.com wrote:
        >
        >>
        >>"richard" <member@newsguy .comwrote in message
        >>news:cob5h45s 5raiea8621kf1m1 7j4gmf4inlf@4ax .com...
        >>>I have <div id=box1 style="display: block"as the initial setting.
        >>I need to change the "display:bl ock" to "display:no ne" then back to
        >>"display:bloc k" as a means of clearing anything that might be
        >>displayed within the box1 division.
        >>
        >>Changing the display property as above will *not* achieve "clearing
        >>anything
        >>that might be displayed".
        >>
        >
        As I have found out this is true.
        So what will?
        document.getEle mentById("box1" ).innerHTML = "";

        but why? If you don't want stuff displayed in the div then don't put it in
        there.


        Comment

        • Doug Gunnoe

          #5
          Re: changing specific &lt;div&gt; status

          On Nov 6, 3:17 am, richard <mem...@newsguy .comwrote:
          As I have found out this is true.
          So what will?
          What do you mean by "clearing anything that might be displayed"?

          In other words, you are not merely interested in toggling the
          visibility of the div, but you want to empty the contents of the div
          also?

          If that is what you're getting out, maybe consider altering the
          innerHML attribute of the div.

          someDiv.innerHT ML = "";

          Comment

          • richard

            #6
            Re: changing specific &lt;div&gt; status

            On Thu, 06 Nov 2008 09:21:04 GMT, "rf" <rf@invalid.com wrote:
            >
            >"richard" <member@newsguy .comwrote in message
            >news:chd5h4l2u 9cgqa76ak4ct3fs tl0tnl1k9t@4ax. com...
            >On Thu, 06 Nov 2008 09:09:06 GMT, "rf" <rf@invalid.com wrote:
            >>
            >>>
            >>>"richard" <member@newsguy .comwrote in message
            >>>news:cob5h45 s5raiea8621kf1m 17j4gmf4inlf@4a x.com...
            >>>>I have <div id=box1 style="display: block"as the initial setting.
            >>>I need to change the "display:bl ock" to "display:no ne" then back to
            >>>"display:blo ck" as a means of clearing anything that might be
            >>>displayed within the box1 division.
            >>>
            >>>Changing the display property as above will *not* achieve "clearing
            >>>anything
            >>>that might be displayed".
            >>>
            >>
            >As I have found out this is true.
            >So what will?
            >
            >document.getEl ementById("box1 ").innerHTM L = "";
            >
            >but why? If you don't want stuff displayed in the div then don't put it in
            >there.
            >
            Now that, is the response I would expect from a 10 year old.

            I am attempting to design a menu system that will that will have 3
            levels of choices.
            Yeah sure I could use those premade scripts that show your choices as
            long as the cursor is over that item. But I need stability.

            Item 1 has only one choice.
            Items 2 and 3 will have two sublevels to choose from.
            Item 4 will have one level.
            All of which is contained within "box1".
            What you see displayed is the content of your first level item choice.
            So why show the others?


            Of course, I could just as well write a seperate page for each choice
            but that would mean keeping track of that many more pages.

            Comment

            • richard

              #7
              Re: changing specific &lt;div&gt; status

              On Thu, 6 Nov 2008 01:28:20 -0800 (PST), Doug Gunnoe
              <douggunnoe@gma il.comwrote:
              >On Nov 6, 3:17 am, richard <mem...@newsguy .comwrote:
              >As I have found out this is true.
              >So what will?
              >
              >What do you mean by "clearing anything that might be displayed"?
              >
              >In other words, you are not merely interested in toggling the
              >visibility of the div, but you want to empty the contents of the div
              >also?
              >
              >If that is what you're getting out, maybe consider altering the
              >innerHML attribute of the div.
              >
              >someDiv.innerH TML = "";

              Only as far as displaying the content goes, not the complete removal
              of the division.

              Comment

              • rf

                #8
                Re: changing specific &lt;div&gt; status


                "richard" <member@newsguy .comwrote in message
                news:9ve5h4dkgg 33v273ogge6tf64 lg7t6eg3h@4ax.c om...
                On Thu, 06 Nov 2008 09:21:04 GMT, "rf" <rf@invalid.com wrote:
                >
                >>
                >>"richard" <member@newsguy .comwrote in message
                >>news:chd5h4l2 u9cgqa76ak4ct3f stl0tnl1k9t@4ax .com...
                >>On Thu, 06 Nov 2008 09:09:06 GMT, "rf" <rf@invalid.com wrote:
                >>>
                >>>>
                >>>>"richard" <member@newsguy .comwrote in message
                >>>>news:cob5h4 5s5raiea8621kf1 m17j4gmf4inlf@4 ax.com...
                >>>>>I have <div id=box1 style="display: block"as the initial setting.
                >>>>I need to change the "display:bl ock" to "display:no ne" then back to
                >>>>"display:bl ock" as a means of clearing anything that might be
                >>>>displayed within the box1 division.
                >>>>
                >>>>Changing the display property as above will *not* achieve "clearing
                >>>>anything
                >>>>that might be displayed".
                >>>>
                >>>
                >>As I have found out this is true.
                >>So what will?
                >>
                >>document.getE lementById("box 1").innerHTM L = "";
                >>
                >>but why? If you don't want stuff displayed in the div then don't put it in
                >>there.
                >>
                >
                Now that, is the response I would expect from a 10 year old.
                Well while we are here I might point out that your question, with no
                explanation at all for the questions reason, and presuming a "solution" that
                is so totally wrong that we all learnt it in HTML 101 stuff, is what I would
                expect from a 10 year old.

                Do you want help with this or not? If not then you are going about it
                exactly the right way.
                I am attempting to design a menu system that will that will have 3
                levels of choices.
                Bad idea. These things are not accessible, unless you take great pains to
                make them so. How will I get to those lower level items if I don't have a
                mouse? You are, of course, making provision for that, aren't you?
                Yeah sure I could use those premade scripts that show your choices as
                long as the cursor is over that item. But I need stability.
                So use one of them and modify it to suit your needs? From your original "10
                year old" question it might just be better though if you don't attempt to
                modify it.
                Item 1 has only one choice.
                Items 2 and 3 will have two sublevels to choose from.
                Item 4 will have one level.
                All of which is contained within "box1".
                Why. Why not give them each a different box. You are going about this
                entirely the wrong way, but then again this is your usual modus operandi.

                And how did you get the menu items in the div in the first place?
                What you see displayed is the content of your first level item choice.
                So why show the others?
                Why fart about with changing the contents of one single div? Why not do it
                like all the other dropdown menu scripts (and CSS alternatives) out there?
                Use one div per dropdown. Then all you have to do is swich the display mode
                to 'block' for the active one.
                Of course, I could just as well write a seperate page for each choice
                but that would mean keeping track of that many more pages.
                What? Who said anything about pages? We are talking about divs here. If you
                can't keep track of four (yes, I counted) divs then maybe writing web pages
                is not what you should be doing. Driving trucks, perhaps?


                Comment

                • Gregor Kofler

                  #9
                  Re: changing specific &lt;div&gt; status

                  richard meinte:
                  >someDiv.innerH TML = "";
                  >
                  >
                  Only as far as displaying the content goes, not the complete removal
                  of the division.
                  See the solution above or - perhaps more standards compliant - something
                  like:

                  someDiv.childNo des.length = 0;

                  or

                  while(someDiv.h asChildNodes()) {
                  someDiv.removeC hild(someDiv.la stChild);
                  }

                  Anyway, you've been told before that this whole approach for your
                  drop-down menu is idiotic.

                  "Yeah sure I could use those premade scripts that show your choices as
                  long as the cursor is over that item. But I need stability."

                  LOL. So you are replacing the not-too-stable premade scripts, by your
                  own solution, without having the slightest clue of JS and DOM scripting.
                  Interesting.

                  (Does this make me a "ten-year-old"?)

                  Gregor

                  Comment

                  Working...