OVH Cloud OVH Cloud

PB de dhtml/js

1 réponse
Avatar
Thomas
Hello à tous,

J'ai un sérieux pb en dhtml javascript le voici :

<a href="#" onclick="fond='#FFFFFF'; alert(fond);
document.getElementById('gauche').style.color=fond; return
false;">Changer</a>&nbsp;
<a href="#" onclick="fond='#'+document.perso.fond_g.value; alert(fond);
document.getElementById('gauche').style.color=fond; return
false;">Changer</a>

Avec le premier lien, tout marche, ma couleur passe en blanc

Pour le second lien, ça se passe moins bien, mon navigateur me trouve une
erreur, pourant si je fais alert(fond), celui-ci est correct...

Quelqu'un aurait une idée sur ce probleme?

Merci d'avance

1 réponse

Avatar
Bul
non, pas d'idée, tout fonctionne :
<input type="text" name="gauche" style="color:red">
<form name=perso>
<input type="text" name="fond_g" value="654321">
</form>
<a href="#"
onclick=" var fond='#123456';
alert(fond);
document.getElementById('gauche').style.color=fond;
return false;">Changer</a>&nbsp;
<a href="#"
onclick=" var fond='#'+document.perso.fond_g.value;
alert(fond);
document.getElementById('gauche').style.color=fond;
return false;">Changer</a>
@+