From what I can tell, IE doesn't support invented tag names as tags in this type of situation. Better to use a real tag like span and access the elements by their class names like:
Code:
function change(oldClass, newClass) {
var tagged=document.getElementsByTagName('span');
for(var i = 0 ; i < tagged.length ; i++)
if (tagged[i].className==oldClass)
tagged[i].className=newClass;
}
and:
HTML Code:
in their latest <span class="off_fi">financial</span> report, <span class="off_qt">IBM</span> stated that the net project <span class="off_fi">revenue</span> was
The style could be like so but, you really shouldn't need to define the off values in the style section if they have no settings:
Code:
<style type="text/css">
.off_fi, .off_qt {
}
.qtOn {
background: yellow;
}
.fiOn {
background: lightblue;
}
</style>
If you are determined to write as little markup as possible and willing to break a number of rules that most browsers will not hold you to, you can hijack the <b> and <u> tags, setting their css to font-weight:normal and text-decoration:none, respectively and use id's instead of classes for the highlight effects. I would advise against this in this situation.
Bookmarks