I am trying to modify my own web site to have a certain type of dynamic
background through divs... and such.... but what I need, is help with
this one script I have. I want to modify it to work on my site, but I can't
seem to figure out how this function works.
var arBgs =
["singularity"," spellcraft","sk ysong2","mornin glight","anen", "thetismoon ","v
alley2k","fluor escence","indra ","neuron","blu edome","beeds"]
fnChangeBg = function (nIndex) {
var _bg = new Image()
defaultStatus = "Loading background image ["+arBgs[nIndex]+"]. Please
wait..."
_bg.onload = function () {
_cover.style.ba ckgroundImage = "url("+this.src +")"; // THIS IS WHERE I
NEED HELP! WHAT DOES THIS LINE DO?!
defaultStatus = ""
}
_bg.src = "images/working_items/"+arBgs[nIndex]+".jpg"
fnChangeBg.i = nIndex
}
fnChangeBg(Math .floor(Math.ran dom() * (arBgs.length)) )
I guess what I am trying to ask is... what the hell does the _bg.onload
function do?! How does it work... I know most of it, but that one line,
throws me off, due to the THIS keyword. What HTML element does the THIS
word effect?! Anywho, please any help would be appreshiated.
Qzmicro
background through divs... and such.... but what I need, is help with
this one script I have. I want to modify it to work on my site, but I can't
seem to figure out how this function works.
var arBgs =
["singularity"," spellcraft","sk ysong2","mornin glight","anen", "thetismoon ","v
alley2k","fluor escence","indra ","neuron","blu edome","beeds"]
fnChangeBg = function (nIndex) {
var _bg = new Image()
defaultStatus = "Loading background image ["+arBgs[nIndex]+"]. Please
wait..."
_bg.onload = function () {
_cover.style.ba ckgroundImage = "url("+this.src +")"; // THIS IS WHERE I
NEED HELP! WHAT DOES THIS LINE DO?!
defaultStatus = ""
}
_bg.src = "images/working_items/"+arBgs[nIndex]+".jpg"
fnChangeBg.i = nIndex
}
fnChangeBg(Math .floor(Math.ran dom() * (arBgs.length)) )
I guess what I am trying to ask is... what the hell does the _bg.onload
function do?! How does it work... I know most of it, but that one line,
throws me off, due to the THIS keyword. What HTML element does the THIS
word effect?! Anywho, please any help would be appreshiated.
Qzmicro
Comment