- This topic is empty.
December 10, 2014 at 5:38 am #190505
how do u get a random number an apply as a background on load to the body
found this link how do u do itDecember 10, 2014 at 5:41 am #190507
It’s not clear what you are asking for.
A ‘number’ can’t be a background.
What are you trying to do?December 10, 2014 at 5:44 am #190509
var colors = [‘red’, ‘green’, ‘blue’, ‘orange’, ‘yellow’]
so like when u refresh the page there is a new background colorDecember 10, 2014 at 5:45 am #190511
It’s still not clear.
Are you saying that you want the JQuery function as pure JS?December 10, 2014 at 5:51 am #190512
OK, that’s the language barrier hurdled…now that we know what you actually want, I’ve changed the title so perhaps a JS expert can assist you.December 10, 2014 at 5:53 am #190514
i found a link on stack where in u can generate a random number id didn’t know how to implement it . Can you help paulieDecember 10, 2014 at 6:13 am #190515Ilan FirsovParticipant
Here (check JS tab)
just make sure to put it right before the closing
**I tried to write it inside code tags here but got blocked by the firewall. apparently this little JS script is an SQL injection attack :PDecember 10, 2014 at 6:25 am #190516
I tried to write it inside code tags here but got blocked by the firewall. apparently this little JS script is an SQL injection attack
This site is very sensitive to any JS that escapes the code ticks so it tends to reject it.
Codepen is always your best bet.December 11, 2014 at 8:45 am #190607
thanks paulie an Ilan Firsov but what if i have to add different colors to the li on load but the bg color should be different so like how do i archive that an thanks to i got to learn how Math.floor works this site really helps in learning an the people here too can u please help me on the below thingDecember 11, 2014 at 9:00 am #190608
I think you’re doing this piecemeal instead of telling us what the concept is and asking the best solution.
At the moment, you’re running 5 different functions ( I think) instead of one same function 5 times.December 13, 2014 at 6:23 am #190724
what would be the best way of doing it since i don’t have experience in js just a beginner paulie_d if u could help if would be great
mavenDecember 13, 2014 at 8:56 am #190727
That’s a very broad question. One that’s not really suited to a forum such as this.December 15, 2014 at 8:50 am #190853
guys i have been told to implement on a unit now i have a ul li on refresh of the page the background color of the li should change i have 5 list items so when i refresh the page the 5 listed items should have different backgrounds so like i don’t get a repeated background