set/adjust z-index onmouseover

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

    #1

    set/adjust z-index onmouseover

    What would be the correct syntax for setting the z-index of a layer
    OnMouseOver?

    I have a mouseover action on a visible layer which displays a popup info
    layer but it gets displayed behind other visible layers depending on its ID
    which I beleive is inherited from its parent. I need the popup layer to
    display in front of everything on the page when activated.

    <DIV ID="popinfo<%=r s("ID") %>" STYLE="padding: 0px; border:1px solid
    #000000; position: absolute; width: 300px; height: 220px; left: 36px;
    top: -1px; z-index: <%=rs("ID") %>" ; background-color:#2D5B8E;
    visibility:hidd en">

    Thanks in advance!



  • Stephen Chalmers

    #2
    Re: set/adjust z-index onmouseover

    Jake <spamthis@allte l.net> wrote in message
    news:jq4Md.89$8 M.58@fe10.usene tserver.com...[color=blue]
    > What would be the correct syntax for setting the z-index of a layer
    > OnMouseOver?
    >
    > I have a mouseover action on a visible layer which displays a popup info
    > layer but it gets displayed behind other visible layers depending on its[/color]
    ID[color=blue]
    > which I beleive is inherited from its parent. I need the popup layer to
    > display in front of everything on the page when activated.
    >
    > <DIV ID="popinfo<%=r s("ID") %>" STYLE="padding: 0px; border:1px solid
    > #000000; position: absolute; width: 300px; height: 220px; left: 36px;
    > top: -1px; z-index: <%=rs("ID") %>" ; background-color:#2D5B8E;
    > visibility:hidd en">
    >
    > Thanks in advance!
    >
    >[/color]
    It's better to simplify the syntax by writing a function to do the job.
    Here's an example using two simple layers. I chose to style the popup
    initially visible.

    <html>
    <head>
    </head>
    <body>

    <DIV id='popup' style="position :absolute;left: 100px; top:50px;
    background-color:#ffff00;z-index:0;visibil ity:visible;">P opup text
    layer</DIV>
    <DIV onmouseover='to Top("popup",tru e,100)'
    onmouseout="toT op('popup',fals e,0)" id='perm'
    style="position :absolute;left: 50px; top:55px;
    background-color:#ff0000;z-index:1">The Permanent Layer</DIV>

    <script type='text/javascript'>

    function toTop(layer, action, z) // layer== id of div, action:
    true==show,fals e==hide, z==z index
    {
    var lref;

    if(document.get ElementById && (lRef=document. getElementById( layer)))
    {
    lRef.style.visi bility=action?' visible':'hidde n';
    lRef.style.zInd ex=z;
    }
    }
    </script>
    </html>



    --
    S.C.




    Comment

    • Jake

      #3
      Re: set/adjust z-index onmouseover

      Thanks for the reply but I cant get your sample to work.

      Error: Expected '{'


      "Stephen Chalmers" <ignoring@lycos .co.uk> wrote in message
      news:42017c4e$1 _2@mk-nntp-2.news.uk.tisca li.com...[color=blue]
      > Jake <spamthis@allte l.net> wrote in message
      > news:jq4Md.89$8 M.58@fe10.usene tserver.com...[color=green]
      >> What would be the correct syntax for setting the z-index of a layer
      >> OnMouseOver?
      >>
      >> I have a mouseover action on a visible layer which displays a popup info
      >> layer but it gets displayed behind other visible layers depending on its[/color]
      > ID[color=green]
      >> which I beleive is inherited from its parent. I need the popup layer to
      >> display in front of everything on the page when activated.
      >>
      >> <DIV ID="popinfo<%=r s("ID") %>" STYLE="padding: 0px; border:1px solid
      >> #000000; position: absolute; width: 300px; height: 220px; left: 36px;
      >> top: -1px; z-index: <%=rs("ID") %>" ; background-color:#2D5B8E;
      >> visibility:hidd en">
      >>
      >> Thanks in advance!
      >>
      >>[/color]
      > It's better to simplify the syntax by writing a function to do the job.
      > Here's an example using two simple layers. I chose to style the popup
      > initially visible.
      >
      > <html>
      > <head>
      > </head>
      > <body>
      >
      > <DIV id='popup' style="position :absolute;left: 100px; top:50px;
      > background-color:#ffff00;z-index:0;visibil ity:visible;">P opup text
      > layer</DIV>
      > <DIV onmouseover='to Top("popup",tru e,100)'
      > onmouseout="toT op('popup',fals e,0)" id='perm'
      > style="position :absolute;left: 50px; top:55px;
      > background-color:#ff0000;z-index:1">The Permanent Layer</DIV>
      >
      > <script type='text/javascript'>
      >
      > function toTop(layer, action, z) // layer== id of div, action:
      > true==show,fals e==hide, z==z index
      > {
      > var lref;
      >
      > if(document.get ElementById && (lRef=document. getElementById( layer)))
      > {
      > lRef.style.visi bility=action?' visible':'hidde n';
      > lRef.style.zInd ex=z;
      > }
      > }
      > </script>
      > </html>
      >
      >
      >
      > --
      > S.C.
      > http://makeashorterlink.com/?H3E82245A
      >
      >
      >[/color]



      Comment

      • John Doe

        #4
        Re: set/adjust z-index onmouseover

        In article <3egMd.163$8M.5 0@fe10.usenetse rver.com>, spamthis@alltel .net
        says...[color=blue]
        > Thanks for the reply but I cant get your sample to work.
        >
        > Error: Expected '{'
        >[/color]
        That's because his code wrapped. If you really can't figure out that
        problem for yourself, you might want to look at one of the many free
        javascript tutorials on the web, and focus on the troubleshooting
        sections. The line which begins "true==show " can be safely deleted or
        can be returned to its original position at the end of the line above
        it.
        [color=blue][color=green]
        > > function toTop(layer, action, z) // layer== id of div, action:
        > > true==show,fals e==hide, z==z index
        > > {
        > > var lref;
        > >[/color][/color]

        Comment

        • Stephen Chalmers

          #5
          Re: set/adjust z-index onmouseover





          Jake <spamthis@allte l.net> wrote in message
          news:3egMd.163$ 8M.50@fe10.usen etserver.com...[color=blue]
          > Thanks for the reply but I cant get your sample to work.[/color]

          It's a line-wrap problem. Replace the function with this:

          // layer== id of div, action:true==sh ow,false==hide, z==z index
          function toTop(layer, action, z)
          {
          var lref;

          if(document.get ElementById && (lRef=document. getElementById( layer)))
          {
          lRef.style.visi bility=action?' visible':'hidde n';
          lRef.style.zInd ex=z;
          }
          }

          --
          S.C.





          Comment

          • Stephen Chalmers

            #6
            Re: set/adjust z-index onmouseover





            Jake <spamthis@allte l.net> wrote in message
            news:3egMd.163$ 8M.50@fe10.usen etserver.com...[color=blue]
            > Thanks for the reply but I cant get your sample to work.[/color]

            It's a line-wrap problem. Replace the function with this:

            // layer== id of div, action:true==sh ow,false==hide, z==z index
            function toTop(layer, action, z)
            {
            var lref;

            if(document.get ElementById && (lRef=document. getElementById( layer)))
            {
            lRef.style.visi bility=action?' visible':'hidde n';
            lRef.style.zInd ex=z;
            }
            }

            --
            S.C.





            Comment

            Working...