www.webdeveloper.com
Results 1 to 2 of 2

Thread: A little help please

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    A little help please

    Can anyone tell me why this doesnt work?


    <script type="text/javascript">
    function changeClassHoverPane(){
    var change=this.id;
    function theChange(){
    document.getElementById(change).className='content-pane 1 transition';
    }
    setTimeout(theChange, 2000);
    }
    </script>



    <div class="content-container">
    <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
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    792
    Just pass the object, you do not need the id:

    Code:
    <script type="text/javascript">
    
    	function changeClassHoverPane(e)
    	{
    		if (e.tid) {clearTimeout(e.tid);}
    		e.tid = setTimeout(function() {e.className='content-pane transition';}, 2000);
    	}
    
    </script>
    
    <div class="content-container">
    	<div class="content-pane 1 transition" id="c-1" onmouseover="this.className='hover-pane';" onmouseout="changeClassHoverPane(this);" >
    		<a class="transition" href="http://www.thephpboss.com/">The php boss dot com is here......</a>
    	</div>
    </div>
    JavaScript: Learn | Validate | Compact

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