Jump to content

random css image selection - pure vanilla javascript/css?


rootKID

Recommended Posts

Hi W3S! Been a while (as always).

So i am in need of support yet again.

I have this fun project of mine, where i have 2 background images i really wonna show, but at random on each page load...

so as the title says, is there a way to do this with simple javascript? As said i have 2 background images i wanna show and since im not the best with javascript, i kinda hoped i could get you guys to show me an example or at least guide me to where i could look? I have looked at W3Schools main website but not sure if i'm looking in the right spot.

Many thanks in advance! :D

PS:

The idea behind the background images is that they should be attached to the "<body>" tag for kinda "overlayers". If that makes sence? I already have a "black" background, and these images are supposed to look like "x"s... but in different colors... hense the random images...

Anyways as always, thanks in advance and i hope you guys can help me... again... as always...

Happy new year so far, and hope all are with good health! And watch out! <3

Regards, rootKID :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...