Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random rotation

Status
Not open for further replies.

SjrH

IS-IT--Management
Joined
Jun 24, 2003
Messages
747
Location
GB
Is it possible to have two random numbers generated on the same page?

I'm using

Code:
RNL = (Math.round((Math.random()*1)+1))
RNR = (Math.round((Math.random()*5)+1))

To randomly rotate a left banner (RNL) & right banner (RNR) respectively. Bit crude I guess but it'll suffice for now!

The problem only occurs if both randomisers are on the same page, if I rem one out, the other works fine. Is there a way around this?

Thanks
 
Is it possible to have two random numbers generated on the same page?
Sure is! And your code works fine. What problem are you experiencing? I got no errors in Firefox.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Doh!

Sorted it :) When I added the second lot of code I renamed the original arrays and random element but forgot to modify the mouseover array to match so it was undefined.

Is it friday yet?!

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top