- Joined
- Aug 19, 2007
- Messages
- 4,941
- Solutions
- 11
- Reaction score
- 352
Windows 7 like random wallpaper.
Save as *.html, right click on desktop -> properties -> desktop -> browse... and select this *.html file. It will change your wallpaper every X seconds.
Code:
<html>
<body style="margin: 0 0 0 0; background-color: black;">
<script type="text/javascript">
function setWallpaper(oldWallpaper)
{
var wallpapers = ["tapeta.jpg", "tapeta_.jpg", "tapeta__.jpg", "tapeta___.jpg"];
var dim = [1280, 1024];
var timeout = 60000;
var type = "normal";
var rand = oldWallpaper;
if(type == "random")
{
rand = Math.floor(Math.random() * wallpapers.length);
while(oldWallpaper == rand)
rand = Math.floor(Math.random() * wallpapers.length);
}
else if(type == "normal")
if(rand >= wallpapers.length - 1)
rand = 0;
else
rand = rand + 1;
var img = new Image();
img.src = wallpapers[rand];
document.body.innerHTML = "<img src=\"" + img.src + "\" width=\"" + dim[0] + "\" height=\"" + dim[1] + "\" />";
setTimeout("setWallpaper(" + rand + ")", timeout);
}
setWallpaper(-1);
</script>
</body>
<html>
Save as *.html, right click on desktop -> properties -> desktop -> browse... and select this *.html file. It will change your wallpaper every X seconds.
- var wallpapers -> list with YOUR files (in the same dir as *.html file)
- var dim -> [width, height] of your screen
- var timeout -> how long it will take to switch wallpapers in ms (1 second = 1000 ms)
- var type -> either random (for random wallpaper from array) or normal (same as array order)
- var rand -> dont edit, heh
Last edited: