Salve ho un piccolo problema conun codice javascript.
Ho creato una funzione che catturi l'id (X) di un tag html e cambi il colore di sfondod ella pagina in base a un secondo parametro che le passo (C).
Vi posto il codice, se il rpoblema non dovesse esser chiaro ditelo!
Perchč quando premo nei tre link il colore di sfondo non cambia?
codice:
function cambia_sfondo (X, C)
{document.getElementById(X).style.background='C';
}
Forse l'errore č qua, ma boh...
Il codice completo:
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
<style type="text/css">
body { background: #FC3; }
div {
margin: 30px;
border: 1px dashed #000;
padding: 0px;
text-align: center;
}
img {
/*display: block;*/
border: 0px;
padding: 10px;
}
</style>
<script language="javascript">
function cambia_sfondo (X, C)
{document.getElementById(X).style.background='C';
}
</script>
</head>
<body id="pagsfondo">
<div>
[img]avvisi70.png[/img]
[img]curiositāmondo70.png[/img]
[img]hardware70.png[/img]
[img]linux70.png[/img]
[img]microsoft70.png[/img]
[img]p2p70.png[/img]
[img]softwaresicurezza70.png[/img]
[img]tecnologia70.png[/img]
[img]telefonia70.png[/img]
[img]videogame70.png[/img]
[img]web70.png[/img]
</div>
BIANCO |
BLU |
VIOLA |
</body>
</html>