Hallo,
Ich suche nach einer DOM-kompatiblen Lösung.
Das waere eine, ist aber nicht fuer Opera geeignet:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test by TM 04/05</title>
[code lang=javascript]<script type="text/javascript">
<!--
function Test()
{
var sty=document.createElement("style");
document.getElementsByTagName("head").item(0).appendChild(sty);
// fuer IE:
if(document.styleSheets.item(0).addRule)
document.styleSheets.item(0).addRule(".abc","color: #00C; background-color: #FFC;");
// fuer Mozilla:
else if(document.styleSheets.item(0).insertRule)
document.styleSheets.item(0).insertRule(".abc {color: #00C; background-color: #FFC;}",0);
document.getElementsByTagName("body").item(0).className="abc";
}
//-->
</script>
</head>
<body onload="Test()">
<p>Text ...</p>
</body>
</html>[/code]
MfG, Thomas