loser: random css <ns 5

Hallo,
ich habe im Archiv folgendes script gefunden, um eine css datei per zufall einzubinden, allerdings mit dem hinweis, daß dies beim ns 4.7 und kleiner nicht funktionert. geht es auch ohne den 'getelementbyid- Tag' und damit auch bei ns <5 ?

<html>
<head>
<title></title>

<script language="JavaScript">
 <!-- random css url

function RandomCSS() {
 var zufall = Math.random();
 if (zufall <= 0.3) {document.write("<link rel='stylesheet' type='text/css' href='001.css'>");

else if (zufall > 0.3 && zufall <= 0.6) {document.write("<link rel='stylesheet' type='text/css' href='002.css'>");

else if (zufall > 0.6 && zufall <= 1) {document.write("<link rel='stylesheet' type='text/css' href='003.css'>");
 }

// -->
</script>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000" onLoad=RandomCSS()>
<p class="unnamed1">Hallo Welt</p>
<p class="unnamed1">hallo</p>
</body>
</html>

  1. Hi Loser
    Leider funktioniert das StyleSheet nicht ganz ohne dieses Tag, wobei ich hier deine Frage nicht ganz verstehe. Bei mir funktioniert dieses Script unter NS4.7 unter folgendem Zustand:

    In den CSS-Datei (mit verschiedenen Schriftangaben, hier nur ein Beispiel):

    #MusterID{
    font-family: Arial;
    }

    .MusterCLASS{
    font-family: Arial;
    }

    In der HTML-Datei:
    <html>
    <head>
    <title></title>

    <script language="JavaScript">
     <!-- random css url

    function RandomCSS() {
     var zufall = Math.random();
     if (zufall <= 0.3) {document.write("<link rel='stylesheet' type='text/css' href='001.css'>");

    else if (zufall > 0.3 && zufall <= 0.6) {document.write("<link rel='stylesheet' type='text/css' href='002.css'>");

    else if (zufall > 0.6 && zufall <= 1) {document.write("<link rel='stylesheet' type='text/css' href='003.css'>");
     }

    // -->
    </script>
    </head>
    <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000" onLoad=RandomCSS()>
    <p id="MusterID">Hallo Welt</p>
    <p class="MusterCLASS">hallo</p>
    </body>
    </html>

    Wo hast du das Script eigentlich genau her?