Results 1 to 12 of 12

Thread: Layers! Woohoo!

  1. #1

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935

    Layers! Woohoo!

    I made a nice happy layer:
    Code:
    <div id="desc" style="position:static; z-index:1">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Move the mouse over the icons above to
    see their descriptions.</font>
    </div>
    Using Javascript, how can I clear the contents of the layer and write new text to it?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    IE
    Code:
    <script>
    function changeIt()
    {
        document.all.desc.innerHTML = "<b>I am not a pretty elf</b>"
    }
    </script>
    
    <div id="desc" style="position:static; z-index:1">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Move the mouse over the icons above to
    see their descriptions.</font>
    </div>
    That should work.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    What about evil NS4?

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by filburt1
    What about evil NS4?
    I refuse to test stuff for NS, but I imagine that it won't work.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    In NS4 its ...

    Code:
       with(document.layers[layerID].document){
             open();
             write(txt);
             close();
        }
    ..but use this function I wrote, Its cross-browser complient...

    Code:
        function writeLayer(layerID,txt){
                if(document.getElementById){
                      document.getElementById(layerID).innerHTML=txt;
                }else if(document.all){
                      document.all[layerID].innerHTML=txt;
                }else if(document.layers){
                      with(document.layers[layerID].document){
                            open();
                            write(txt);
                            close();
                      }
                }
          }
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  6. #6

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Cheers, I'll try it out

  7. #7

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Well it writes to the layer, but it doesn't clear what's in the layer already. How would I do that using your cross-browser function?

  8. #8

  9. #9
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Why you so concerned about NS4...that's well old hat now. 6.2 is out

  10. #10

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Still doesn't hurt to be compliant...

    Hobo: Checking those out now...

  11. #11

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    OMG, it was already clearing what was in the layer, stupid me

    Bah, fine Chris, screw NS4

  12. #12
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by filburt1
    Bah, fine Chris, screw NS4
    amen brother

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width