hi, im posting this because i cant find my problem, the thing is that my script works fine on Opera, Firefox, Chrome and Safari but it doesnt work on IE, i have the newest version of IE and have been trying everything please help the page is here

(code that isnt working is the frame that appears when u click an item)
http://test.totalwebdata.com

i used that subdomain from my server to hide my client domain, its clean and safe, u can look all the javascript code in the Source Code

Thanks

Recommended Answers

All 4 Replies

Your problem goes with the getElementById method, were it is only available for IE7+ browser.
If you want to make it cross-platform, you'll need to provide separated statements that handles IE6-.
Here's a short example:

var obj;
if ( document.getElementById && !document.all ) { // Applies to all modern browsers.
   obj = document.getElementById("elemId");
} else if ( document.all ) { // Works in all IE mode browser
   obj = document.all.elemId; }
   alert( obj.id );

you can also do it shorthand:

var obj = (( document.getElementBy ) ? document.getElementById("elemId") : document.all.elemId );

i change all the GetElementById('elemId') for document.all.elemId; and it still works on all the browser but the IE problem is still there :S is the any other workaround?

This is the moded version of your script, all you need to do, is replace the entire <script></script> block that enclosed this functions.
<<< NO NEED TO EDIT >>>

<script type="text/javascript">
// <![CDATA[
var isOpen = false;
var spawn;
var pop1, pop2;
var viaID;
var hidep;
var imgUrl, iPath;
viaID = Boolean( document.getElementById );

spawn = function( N ) { 
   if ( !isOpen ) { 
   pop1 = (( viaID ) ? document.getElementById("popup") : document.all.popup );
   pop2 = (( viaID ) ? document.getElementById("popup2") : document.all.popup2 );
      try {
      pop1.style.display = "block";
      pop2.style.display = "block";
      imgUrl = [ ];
   iPath = [ "Content/img/BigShirt.png",
   "Content/img/BigLlavero.png",
   "Content/img/BigVaso.png",    "Content/img/BigGorra.png",
   "Content/img/BigRelog.png",
   "Content/img/BigNavaja.png",
   "Content/img/BigTarro.png",
   "Content/img/BigPorta.png",
   "Content/img/BigJuguete.png" ];
         for ( var x = 0; x < iPath.length; x++ ) {
         imgUrl[ x ] = new Image();
         imgUrl[ x ].src = iPath[ x ];
         } // New Image Object Created.
         try {
         loadimg = document.createElement("img");
         loadimg.id = "FotoA";
         loadimg.src = imgUrl[ N ].src;
        pop1.appendChild(loadimg);
      isOpen = true;
      } catch( e1 ) {
      pop1.innerHTML += "<img src=\"" + imgUrl[ N ] + "\" id=\"FotoA\" alt=\"" + imgUrl[ N ] + "\" />\n";
      }
   } catch( e2 ) {
   dBlock = document.createAttribute("style");
   dBlock.nodeValue = "style=\"display : block;\"";
         if ( dBlock ) {
         pop1.setAttributeNode( dBlock );
         pop2.setAttributeNode( dBlock );
         } else {   
         pop1.setAttribute("style", "display : block;");
         pop2.setAttribute("style", "display : block;");
         }
      }
   }
};

hidep = function() {
   isOpen = false;
   pop1 = (( viaID ) ? document.getElementById("popup") : document.all.popup );
   pop2 = (( viaID ) ? document.getElementById("popup2") : document.all.popup2 );
   cIMG = (( viaID ) ? document.getElementById("FotoA") : document.all["FotoA"] );
   pop1.removeChild( cIMG );
   try {
   pop1.style.display = 'none';
   pop2.style.display = 'none';
   } catch( e3 ) {
   dNone = document.creatAttribute("style");
   dNone.nodeValue = "display : none;";
      if ( dNone ) {
      pop1.setAttributeNode( dNone );
      pop2.setAttributeNode( dNone );
      } else {
      pop1.setAttribute("style", "display : none;");
      pop2.setAttribute("style", "display : none;");
      }
   }
};
// ]]>
</script>

It works! wow thats a lot of work u did there
karma+++ for you today =D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.