javascriptinternet-explorerconditional-commentsscript-debugging

IE Fixes - Conditional Comment Script will not execute


I'm trying to build a website. I have it displaying correctly in every browser except IE versions 8 and lower. IE renders blue boxes around my img's that are also anchors. I can get rid of this by setting the border property to none but i'd like to do it with javascript. I can get my Javascript to execute in a conditional comment.

try
{
var ancs = document.getElementsByTagName("a");

    for(var i=0; i<ancs.length; i++)
    {
        if(ancs[i].childNodes[0].nodeName == "IMG")
        {
            //Set border property to none
        }
    }
}
catch(err)
{
alert(err);
}

Solution

  • I am sorry for not answering to the javascript part. But you should do it with CSS like this:

    a img { border:0; }