Hi, I need help in the my script, please ...

Discussion in 'JavaScript' started by JrC_Developer, May 28, 2008.

  1. #1
    Hi, I need that the "div#animacao" move for other place in page, but in slow speed ...
    I already make this code:
    
    //js code
    
    function moveDiv(){
    	var end = 600;	
    	var objTarget = document.getElementById('animacao');
    	
    	for( var i = 0; i <= end; i++) {
    	var path = objTarget.style.height= i + 'px';
    		setTimeout(path, 9000);
    	}		
    }
    window.onload = function() {
    	setTimeout(moveDiv, 900);
    }
    
    Code (markup):
    
    <!--html code-->
    
    <style type="text/css">
    body {
    	background-color:#FF6600;
    	color:#FFFFFF;
    }
    #animacao{
    	width:300px;
    	height:300px;
    	background-color:#333;
    	position:absolute;
    }
    </style>
    </head>
    
    <body>
    <div id="animacao"></div>
    </body>
    </html>
    
    
    HTML:
    help me please ...
     
    JrC_Developer, May 28, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    function moveDiv(){
    	var stopAt = 600;
    	var object = document.getElementById('animacao');
    	var current = parseInt(object.style.height);
    	if( current < stopAt ){
    		object.style.height = parseInt(object.style.height) + 1;
    		setTimeout("moveDiv()",900);
    	}
    }
    window.onload = function() {
    	moveDiv();
    }
    Code (markup):
    see if that breaks :p lemme know if any errors
     
    crath, May 28, 2008 IP
  3. JrC_Developer

    JrC_Developer Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for help, but not work ...
    The Div don't move ...
    I test in Firefox, IE, Safari and Opera.
    Don't word in none ...

    What it can be happening?
     
    JrC_Developer, May 28, 2008 IP
  4. JrC_Developer

    JrC_Developer Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for help, but not work ...
    The Div don't move ...
    I test in Firefox, IE, Safari and Opera.
    Don't work in none ...

    What it can be happening?[/QUOTE]
     
    JrC_Developer, May 28, 2008 IP