hmmm non mi funziona però...

Questo è il codice:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Interazione con javascript: Esempio 4</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="HAPedit 3.1">
<style type="text/css">

body{font: 76% Verdana, Arial, sans-serif}
div#container{width: 250px}
h1{color: #68B0D8;font: 170% Georgia, serif}
a{color: #00f}

div#commenti p{width: 200px; padding: 0 5px;
border:1px solid #68B0D8;background-color: #C8ECFF}


div#immagine img{margin: 10px 0;border: 1px solid #ccc;padding: 4px}


</style>

<script type="text/javascript" src="showhide.js"></script>
</head>
<body>
<div id="container">
<h1>Interazione con javascript</h1>


In questo ultimo esempio, vedremo come sia possibile separare totalmente html, css e javascript.</p>

<div id="commenti" class="toggle">


Sezione dei commenti - con javascript &egrave; molto semplice mostrare e nascondere un elemento di pagina.</p>
</div>


Un paragrafo... In questo ultimo esempio, vedremo come sia possibile separare totalmente html, css e javascript. Quella che segue è un immagine digitale...</p>
<div id="immagine" class="toggle">
[img]egg.jpg[/img]
</div>
</div>
</body>
</html>



Mentre nel file:showhide.js c'è questo:
if(document.getElementById && document.createElement){
document.write('<style type="text/css">*.toggle{display:none}</style>');
window.onload=function(){
/*le modifiche allo script vanno solo fatte qui*/
Attiva("commenti","mostra commenti","nascondi commenti");
Attiva("immagine","visualizza immagine","nascondi immagine");
}
}

function Attiva(id,s1,s2){
var el=document.getElementById(id);
el.style.display="none";
var c=document.createElement("div");
var link=document.createElement("a");
link.href="#";
link.appendChild(document.createTextNode(s1));
link.onclick=function(){
link.firstChild.nodeValue = (link.firstChild.nodeValue==s1) ? s2 : s1;
el.style.display=(el.style.display=="none") ? "block" : "none";
return(false);
}
c.appendChild(link);
el.parentNode.insertBefore(c,el);
}


anche se questo file non devo toccarlol...