The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Random script doesn`t work

2 posters

Go down

Random script doesn`t work Empty Random script doesn`t work

Post by Mateja August 18th 2008, 1:26 am

Hello!

Can someone, please, tell me, what is worng with my script for random text? I put it on a portal, but it just didn`t work.

Code:
SCRIPT>joke0= "joke here";joke1= "joke here";joke2= "joke here";joke3= "joke here";var ran_unrounded=Math.random()*3;var ran_number=Math.round(ran_unrounded);document.write(eval("joke"+ran_number));</SCRIPT>

Thank you.
Mateja
Mateja
Forumember

Female Posts : 96
Reputation : 0
Language : English, Espanol, Detusch

Back to top Go down

Random script doesn`t work Empty Re: Random script doesn`t work

Post by zakir321 August 18th 2008, 3:18 pm

It should work though, but here are two possible sources of trouble:

the initial tag is not complete, be sure you have written "<script>" instead of just "script>". Also, note that you have all options named "joke here", even if it chooses a random one, you might not notice a difference. Wink
avatar
zakir321
New Member

Posts : 0
Reputation : 2
Language : english

Back to top Go down

Random script doesn`t work Empty Re: Random script doesn`t work

Post by Mateja August 18th 2008, 5:01 pm

Acctually I have written <script> (made a mastek when I was copied & pasted).

I`ve also already used different names of options so this isn`t the problem..

What can be possibly wrong?
Mateja
Mateja
Forumember

Female Posts : 96
Reputation : 0
Language : English, Espanol, Detusch

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum