codice:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function img() {
var stato = document.getElementById('luce').src
if(stato == 'http://www.nomesito.ext/images/a.png'){
document.getElementById('luce').src='images/b.png';
document.getElementById('luce').setAttribute('alt','luce accesa');
document.body.style.backGroundColor='#ffffff';
}else{
document.getElementById('luce').src='images/a.png';
document.getElementById('luce').setAttribute('alt','luce spenta');
document.body.style.backGroundColor='#000000';
}
}
</script>
</head>
<body>
<a onclick="img()">[img]images/a.png[/img]</a>
</body>
</html>