View Single Post
Old 10-11-2012, 11:33 PM   PM User | #2
anotherJEK
Regular Coder

 
Join Date: Aug 2010
Location: Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
Posts: 152
Thanks: 41
Thanked 1 Time in 1 Post
anotherJEK is an unknown quantity at this point
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
anotherJEK is offline   Reply With Quote