Code:
// using absolute addressing for image files
this.imgPath = 'http://localhost/SC_branch_3/SC_buttons/';
this.preLoad = function(b)
{
if(document.images) //creates image object array for preload.
{
var img = new Array(b.length);
for(var i = 0; i < b.length; i++)
{
img[i] = new Image();
img[i].src = this.imgPath+b[i];
};
//// alert(img[1].src) << checks out
return img;
}
}
// event registration code
elementEvents.buildAllImgButtons = function()
{
with(elementEvents)
{
var NN = false;
for(var i = 0; i < allImgButtonROE.length; i++ )
{
switch(this.clientType)
{
case 'DOM':
allImgButtonROElst[i] = document.getElementById(allImgButtonROE[i].tag);
allImgButtonROElst[i].addEventListener('mouseover', function(e) { findAllImgButtons(e) }, false);
allImgButtonROElst[i].addEventListener('mouseout', function(e) { findAllImgButtons(e) }, false);
allImgButtonROElst[i].addEventListener('click', function(e) { findAllImgButtons(e) }, false);
break;
case 'IE':
allImgButtonROElst[i] = getElementById(allImgButtonROE[i].tag);
allImgButtonROElst[i].attachEvent('onmouseover', function() { findAllImgButtons(window.event) } );
allImgButtonROElst[i].attachEvent('onmouseout', function() { findAllImgButtons(window.event) } );
allImgButtonROElst[i].attachEvent('onclick', function() { findAllImgButtons(window.event) } );
break;
case 'old Netscape':
NN = true;
break;
default:
break;
}
}
if(NN == true) { alert('Please update your browser'); }
}
}
// findAllImgButtons() code:
elementEvents.findAllImgButtons = function(e)
{
var target = e.target.id || window.event.srcElement.id;
var type = e.type || window.event.type;
for(var i = 0; i < this.allImgButtonROE.length; i++)
{
if(this.allImgButtonROE[i].img == target)
{
switch(type)
{
case 'mouseover':
this.allImgButtonROE[i].over(buttons);
break;
case 'mouseout':
this.allImgButtonROE[i].out(buttons);
break;
case 'click':
this.allImgButtonROE[i].click();
break;
}
}
}
}
So, nothing has been working in Safari, nor Chrome, not even the
methods I thought was successful in Safari.
error text in Safari:
TypeError: 'undefined' is not an object (evaluating 'document.img1.src = buttons[27].src')
similar in Chrome