General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
browser vs dynamic javascript differences
Posted by: Robin@reportlab.com
Date: July 11, 2002 10:33PM

I'm using the following stylesheet with javascript dynamically generated tables
<style type="text/css">
.GROUPBOX {width: 300px}
.DOCBOX {width: 400px}
a.upLink:visited,a.upLink:link,a.upLink:active,a.dnLink:visited,a.dnLink:link,a.dnLink:active,a.delLink:visited,a.delLink:link,a.delLink:active {text-decoration: none}
a.upLink:link,a.upLink:visited {color:#00ff00}
a.upLink:active {color:#00ff00;font-weight:bold}
a.dnLink:link,a.dnLink:visited {color:#0000ff}
a.dnLink:active {color:#0000ff;font-weight:bold}
a.delLink:link,a.delLink:visited {color:#ff0000}
a.delLink:active {color:#ff0000;font-weight:bold}
</style>

the js code is of the form
function appendTd(tr,txt,colspan){
var td=document.createElement('td');
if(txt) td.appendChild(document.createTextNode(txt));
if(colspan>1) td.setAttribute('colSpan',colspan);
tr.appendChildthumbs down;
return td;
}
function appendTdLink(tr,ok,align,cls,href,txt){
var td=appendTd(tr,ok ? '' : '\xa0',1);
if(ok){
td.setAttribute('align',align);
var a = document.createElement('a');
a.setAttribute('href',href);
a.setAttribute('className',cls);
if(txt) a.appendChild(document.createTextNode(txt));
td.appendChild(a);
}
return td;
}
.......
appendTdLink(tr,i>0,'right','upLink','javascript:clickUp('+i+')','up'); appendTdLink(tr,i<DOCS.length-1,'right','dnLink','javascript:clickDn('+i+')','down');
appendTdLink(tr,1,'right','delLink','javascript:clickDel('+i+')','delete');
and I see coloured links with IE 5, but not with K-Meleon 0.6 or NS 6.2. Anyone see what I'm doing wrong?

Options: ReplyQuote
Re: browser vs dynamic javascript differences
Posted by: robin@reportlab.com
Date: July 12, 2002 12:04PM

OK setAttribute('className',...) seems to be an IE only form, but it's also
stated baldly in the O'reilly Javascript book that 'class' isn't used because
it's a reserved word. Seems that attribute 'class' is OK in IE 6.0 as well now.

Options: ReplyQuote
Re: browser vs dynamic javascript differences
Posted by: sven
Date: July 14, 2002 08:58PM

Right way to do it is: obj.className = 'foo'

Options: ReplyQuote


K-Meleon forum is powered by Phorum.