Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How do I make this script work with Mozilla browsers?

Reply
Thread Tools

How do I make this script work with Mozilla browsers?

 
 
Caledonia_558
Guest
Posts: n/a
 
      11-05-2004
Hi everyone,
I'm having trouble with a bit of code to make a paragraph of text
change colour every second to a new, random colour:
Here's the script's function:

<script type="text/javascript">
function change()
{
re="rgb("+Math.round(Math.random()*256)+","+
Math.round(Math.random()*256)+","+Math.round(Math. random()*256)+")"
text.style.color=re;
}
setInterval(change,1000);
</script>

Then you create the text you want to change colour in a paragraph with
id "text":

<p id="text"> Here is where you type your text. </p>

This works beautifully in IE and Opera, but does absolutely nothing in
Mozilla-based browsers. Can I do anything to this script to make it
work in Mozilla browsers?
Thanks!
 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      11-05-2004
Caledonia_558 wrote:

> text.style.color=re;
> <p id="text"> Here is where you type your text. </p>


http://jibbering.com/faq/#FAQ4_41

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
make pls don't work , i help you make web ,help you do business onthe internet xiaobb03@gmail.com Digital Photography 0 03-13-2008 11:28 AM
CSS Mozilla: Make Mozilla not ignore height style of an inline element Henri HTML 9 02-22-2005 06:08 PM
how to get this script to work in mozilla Jon Javascript 4 11-05-2004 02:03 AM
script works in hta files and also mozilla but not work on IE? lendle Javascript 1 09-21-2004 03:12 AM



Advertisments