I am implementing a JavaScript function that enables/disables two CSS file of a website:
function switch_style ()
{
var i, link_tag ;
for (i = 0, link_tag = document.getElementsByTagName("link"); i < link_tag.length ; i++ )
{
if ((link_tag[i].rel.indexOf( "stylesheet" ) != -1) && link_tag[i].title)
{
if(link_tag[i].title == "normal")
{
link_tag[i].disabled = true;
}
else if (link_tag[i].title == "contrast")
{
link_tag[i].disabled = false;
}
}
}
set_cookie( style_cookie_name, "contrast", style_cookie_duration );
}
As you can see, I enable or disable a link tag. This works in all browsers but not in IE8.
Is there a known reason?