Hi I would like to run two different function but what I need is that First function will run when page load and when first function is done then second function will start and when second function is done then again first function will start and actually again it will repeat same (1 function, 2 function and again 1 function and 2 function) This is the script which highlights letters with one colour and I am trying to do that it will highlights one colour and after that second colour and start from beginning. Thanks for any help var message="Welcome to JavaScript Kit!" var neonbasecolor="gray" var neontextcolor="yellow" var flashspeed=100 //in milliseconds ///No need to edit below this line///// var n=0 if (document.all||document.getElementById){ document.write('') for (m=0;m<message.length;m++) document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>') document.write('') } else document.write(message) function crossref(number){ var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number) return crossobj } function neon(){ //Change all letters to base color if (n==0){ for (m=0;m<message.length;m++) //eval("document.all.neonlight"+m).style.color=neonbasecolor crossref(m).style.color=neonbasecolor } //cycle through and change individual letters to neon color crossref(n).style.color=neontextcolor if (n<message.length-1) n++ else{ n=0 clearInterval(flashing) setTimeout("beginneon()",1500) return } } function beginneon(){ if (document.all||document.getElementById) flashing=setInterval("neon()",flashspeed) } beginneon() </script> </h2> <p align="center">This free script provided by<br /> <a href="http://javascriptkit.com">JavaScript Kit</a></p> HTML:
I see you posted this, your problem must be in this code.. But please dont give us a hard time looking for it..
Code is fine but does just one colour highlight. I wish to make this code to make two colour highlight (first one colour and then second colour and keep repeating again) thanks
<script> var message="Welcome to JavaScript Kit!" var neonbasecolor="gray" var neontextcolor1="yellow" var neontextcolor2="red" var flashspeed=100 //in milliseconds ///No need to edit below this line///// var n=0 var neontextcolor=neontextcolor1 if (document.all||document.getElementById){ document.write('') for (m=0;m<message.length;m++) document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>') document.write('') } else document.write(message) function crossref(number){ var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number) return crossobj } function neon(){ //Change all letters to base color if (n==0){ for (m=0;m<message.length;m++) //eval("document.all.neonlight"+m).style.color=neonbasecolor crossref(m).style.color=neonbasecolor } //cycle through and change individual letters to neon color crossref(n).style.color=neontextcolor if (n<message.length-1) n++ else{ n=0 clearInterval(flashing) setTimeout("beginneon()",1500) return } } function beginneon(){ neontextcolor = (neontextcolor==neontextcolor1) ? neontextcolor2 : neontextcolor1; if (document.all||document.getElementById) flashing=setInterval("neon()",flashspeed) } beginneon() </script> </h2> <p align="center">This free script provided by<br /> <a href="http://javascriptkit.com">JavaScript Kit</a></p>
You are welcome. I am glad that i could help. You can give me a positive feedback by clicking on a start under my post