I was wondering if getAttribute works in IE. I have some code and I put alerts in it for debugging, and it appears to stop at the line with getAttribute. My entire page is: but I doubt it's very important.
Code:<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/TR/html401/strict.dtd"> <html> <head> <title> The Spartan II Project - </title> <link rel="shortcut icon" type="image/ico" href="favicon.ico"></link> <script type="text/javascript" src="js\database.js" id="databaseget"></script> <script type="text/javascript" src="js\loader.js" id="loader"></script> <script type="text/javascript" src="js\unloader.js" id="unloader"></script> <script type="text/javascript" id="init"> var Variables = new Object (); //Buttons var resetBBG = function () { for (var i = 0;i < document.getElementsByTagName ("div").length;i = i + 1) { if (document.getElementsByTagName ("div") [i].getAttribute ("class") == "button") { document.getElementsByTagName ("div") [i].style.backgroundImage = 'url("img/btn-normal.png")'; } } } window.onload = function () { for (var i = 0;i < document.getElementsByTagName ("div").length;i = i + 1) { if (document.getElementsByTagName ("div") [i].getAttribute ("class") == "button") { document.getElementsByTagName ("div") [i].onmousedown = function () { this.style.backgroundImage = 'url("img/btn-down.png")'; } document.getElementsByTagName ("div") [i].onmouseout = function () { this.style.backgroundImage = this.getAttribute ("fakeBG"); } document.getElementsByTagName ("div") [i].onmouseover = function () { this.setAttribute ("fakeBG",this.style.backgroundImage); this.style.backgroundImage = 'url("img/btn-over.png")'; } document.getElementsByTagName ("div") [i].onclick = function () { resetBBG (); this.style.backgroundImage = 'url("img/btn-pressed.png")'; this.setAttribute ("fakeBG",this.style.backgroundImage); } document.getElementsByTagName ("div") [i].innerHTML = "<div class='buttonI'>" + document.getElementsByTagName ("div") [i].innerHTML + "<\/div>"; } } } </script> <style type="text/css"> html { cursor: url("cursor.cur"),pointer; height: 100%; } unloading { display: none; } content { visibility: hidden; } .button { width: 208px; height: 36px; background-image: url("img/btn-normal.png"); } .buttonI { position: relative; color: white; font-family: timesnewroman; font-size: 12pt; font-weight: bold; text-align: center; top: 20%; } </style> </head> <body> <div class="button">Hi All</div><div class="button">Hi all</div><div class="button">Hi all</div> </body> </html>



Reply With Quote



Bookmarks