Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts

    onclick changing inner

    I've got this script that spins an image for me but it dont stop spinning, in other words when i press startspinning with onclick it dont change it to stopspinning function it just keeps spinning, it works fine with href but not onclick.

    Code:
    function StartSpinning() {
    		
    		int = setInterval( 'SpinChange()', 100 );
    		$( 'SpinButton' ).innerHTML = "Spinning (Click to Stop)";
    		$( 'SpinButton' ).onclick = "StopSpinning();";
    		Effect.Fade( 'turns', {duration: 0.3} );
    	
    	}
    	
    	function StopSpinning() {
    		
    		clearInterval( int );
    		$( 'SpinButton' ).innerHTML = "Spin it";
    		$( 'SpinButton' ).onclick = "StartSpinning();";
    		UpdateFigure();
    		Effect.Appear( 'turns', {duration: 0.3} );
    	
    	}
    Can anyone help thanks.

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    $( 'SpinButton' ).onclick = StopSpinning;


  •  

    Posting Permissions

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