dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Why does this not work?

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Why does this not work?

    Simple little function really...


    <script type="text/javascript">
    function changeClassHoverPane(){
    var change=this.id;

    function theChange(){
    document.getElementById(change).className='content-pane 1 transition';
    }
    setTimeout(theChange, 2000);
    }
    </script>

    it changes this:


    <div class="content-pane 1 transition" id="c-1" onmouseover="this.className='hover-pane'" onmouseout="changeClassHoverPane()" >
    <a class="transition" href="http://www.thephpboss.com/">The php boss dot com is here......</a>
    </div>

  2. #2
    Join Date
    Aug 2012
    Posts
    1
    in function changeClassHoverPane, you try using 'this.id' to fetch the id of the div. it's not right.
    you need pass the div element by a param to the function, just like this:

    onmouseout="changeClassHoverPane(this)"

    and in function changeClassHoverPane(ele)
    you can get the id correctly
    var change = ele.id

    hope can help u.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles