0

how can i integrate the codes to make it loop infinte sir/ma'am? i'am a total newbiew, thanks in advance. :D

<script langauage="javascript">
col=255;
function fade ()
{ document.getElementById("fade").style.color="rgb("+ col + "," + col + "," + col + ")"; col-=5; if(col>0)
setTimeout('fade()',25);}
</script>
2
Contributors
3
Replies
6
Views
4 Years
Discussion Span
Last Post by JorgeM
0

Can you elaborate on what exactly you are trying to do?

Are you trying to fade the color of an element?

0

i'm trying to fade some text and i want it loop infinite sir.

1

Use a recursive function. I dont understand how you are going to have an infinite loop on fading a color, but in any event, if you need help with the loop part, here is a sample that you can start with. Place your code within the are below labeled "Your code Here". The function will "loop" every 3 seconds. Change the timeout period to your needs.

<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
</head>

<body>
<script>
   function loop() {        
     // Your code Here  
     setTimeout("loop()", 3000); // 3000 milliseconds = 3 seconds    
   }    

loop();
</script>

</body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.