random bg javascript code
- Started
- Last post
- 23 Responses
- vsc
hello, can anyone point me to a nice javascript code that puts a random bg without writing it in a div or writing the body tag? I need those free of js to run css.
I've searched but can't seem to find any. thanks.
- version30
how bout php?
- airey0
couldn't you make it an external js file and call it in which would leave it out of the css except when called on?
- vsc0
eerh, i don't how to work with php or external js...
and doesn't external js bring those alerts to the user?
- version30
so like do you like the idea of php over js, cuz ya know its alot easier
- vsc0
yeah, from what i know i think i could get there... in 6 months! but i'm really off schedule now...
I was hoping to find the former old NCC site script. that would do it.
:)
- version30
i emailed the script to you
- vsc0
hey, thanks! i think i need 2 years after all... :D
i'll try to work around it fast, though. do i need a bd file to run those bg's?
- vsc0
ahah! unfit. that's the one ;) thanks.
and thank you so much version3. i sure need to get a grasp into that php thing. the ideia of how it works is really enticing, esp. for user sorting menus and such. i'm afraid i'm more into copy and drawings so code frightens me a bit :)
ty all.
- vsc0
hey... is that javascript? :]
- unfittoprint0
hell
yeah.
- vsc0
oh meu deus...
- vsc0
so...
body onload=randombg()
??
- Anarchitect0
azar?
copy/paste the code somewhere in the HEAD tag, between a javascript tag.
http://www.w3.org/TR/REC-html40/…
boa sorte.
- unfittoprint0
o script não precisa de body onload.
ele 'attacha-se' automaticamente ao evento onload [devido ás 3 últimas linhas de código].
- vsc0
ok thx
mas como especifico o dir das imagens? assim?
images.push("../img_db/01.gif");
não está a funcionar...
- Anarchitect0
o teu path corresponde a um 'folder' diferente da página.
Isso não deveria ser um problema.
- vsc0
já fiz o copy/paste:
Untitled Document
images = new Array();
images.push("../img_db/01.gif");
images.push("../img_db/02.gif");
images.push("../img_db/03.gif");
var img = Math.floor(images.length*Math.ra...
function randombg(){
document.body.style.backgroundIm...
}if (window.addEventListener) window.addEventListener("load", randombg, false);
else if (window.attachEvent) window.attachEvent("onload", randombg);
else if (document.getElementById) window.onload=randombg;não está a dar.. :?
- vsc0