javascript random flashing words -



javascript random flashing words -

here's fun little script i'm trying make. flash words array random colors array. (i'm thinking having moving bg type deal.)

i'm having problems creating sort of loop cause words "flash/change" far alter on page reload.

*new* changed 1 function... , works!! seems uses browsers memory or , crashes.... oops... there clear memory or javascript should use??

<html> <head> <style> body { color:black; } #quotes { } </style> </head> <body> <script type="text/javascript"> function showquote() { pickwords = [ "hi!", "welcome!", "hello!" ] var word22 = pickwords[math.floor(math.random()*pickwords.length)]; pickcolors = [ "#aa2233", "#00cc44", "#f342aa" ] var color22 = pickcolors[math.floor(math.random()*pickcolors.length)]; var top22 = (math.floor(math.random()*800)); var left22 = (math.floor(math.random()*800)); var style33 = '<h4 style="padding-bottom:0px; padding-top:'+top22+'px; padding-left:'+left22+'px; font-size: 2.3em; color:'+color22+';">'; var style34 = '</h4>'; var finword22 = style33 + word22 + style34; var duration = 400; document.getelementbyid("quotes").innerhtml=finword22; setinterval('showquote()',duration); } onload = function() { showquote(); } </script> <div id="quotes"></div> </body>

you need 'pickword' within showquote() function.

right now, picking word onload, , utilize word on every timeout.

wrap whole code function , phone call function on load.

function showquote(){ //... settimeout(showquote, duration); } showquote();

javascript random colors word

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -