/    Sign up×
Community /Pin to ProfileBookmark

random wallpaper

Hi there!

I need a script that will be able to change 5 1025×768 wallpapers randomly on my website….

That is to say these wallpapers are fixed and cantered and used as my back grounds….

Is there a script out there that will let me do this?

Thx in advance….

Eldritch ?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@BigMoosieMay 15.2005 — This will do the trick, be sure to define a default background in the CSS for those without javascript disabled.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="en">
<HEAD>
<TITLE>Basic HTML</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<STYLE type="text/css">
<!--
BODY {
background-color: #000000;
background-image: url(image0.jpg);
background-position: center;
}

-->
</STYLE>
</HEAD>
<BODY>
<SCRIPT type="text/javascript">
<!--
var wallpaper=new Array();
wallpaper[0]="image0.jpg"
wallpaper[1]="image1.jpg"
wallpaper[2]="image2.jpg"
wallpaper[3]="image3.jpg"
// just continue the pattern

document.body.style.backgroundImage="url("+wallpaper[Math.floor(Math.random()*wallpaper.length)]+")";
//-->
</SCRIPT>

<!-- html here -->

</BODY>
</HTML>
×

Success!

Help @Eldritch1111 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...