Japh: Problem bei meinem ersten JavaScript Script

Beitrag lesen

Hallo,
ich habe versucht einen "Style-Wechsler" zu programmieren.

Er macht aber nicht unbedingt das was er soll.

Vielleicht könnt ihr mir ja helfen.

  
<!DOCTYPE HTML>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  
    <title>Test</title>  
    <link id="css" rel="stylesheet" type="text/css" href="style1.css" />  
  
    [code lang=javascript]  
    <script type="text/javascript">  
        var	style = document.getElementById( 'css' );  
        function style1(){  
            style.removeAttribute( 'href' );  
            style.setAttribute( 'href', 'style1.css' );  
        }  
        function style2(){  
            style.removeAttribute( 'href' );  
            style.setAttribute( 'href', 'style2.css' );  
        }  
    </script>  
   

</head>
<body>
<h1>Überschrift</h1>

<a href="" onClick="style1();" >Style 1</a>  
<a href="" onClick="style2();" >Style 2</a>  

</body>
</html>

[/code]