SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hiding layers/text

    How can i make layers and text shown/hidden using function calls for javascript

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hiding layers/text

    Originally posted by Andrew-J2000
    How can i make layers and text shown/hidden using function calls for javascript
    Do you want it to be cross browser with NN4.7.

    Cause all you would have to do is create a function called

    function changeState(value,state){
    var whichMenu=value
    eval("document.getElementById('"+whichMenu+"').style.visibility = '"+state+"'")
    }

    Send the name of the layer via value and the state (hidden or visible) via the state var

    eg
    changeState('layer1','hidden');

    If you want a more cross browser model I can show you a bit more if you like.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put this in the head:
    Code:
    <style>function MM_showHideLayers() { //v3.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
        obj.visibility=v; }
    }</style>
    Put this in the body and substitute the link you want to use to show and hide layers as well as positioning and size of layer etc.:
    Code:
     <a href="http://www.mydomain.com/link.htm" onMouseOver="MM_showHideLayers('Layer1','','show');" onMouseOut="MM_showHideLayers('Layer1','','hide')">link</a></p>
    <div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1">layer 
      1 </div>
    This code was generated by Dreamweaver 4.
    Aaron Brazell
    Technosailor



  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanx for the help

    But U can put javascript inside style tags neva knew that

  5. #5
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Andrew,

    If interested, see the "dHTML: an introduction" script/tutorial at my site.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

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