[HTML/JS] Changer la couleur de fond d'un DIV ou d'un INPUT dynamiquem

Changer la couleur de fond d'un DIV ou d'un INPUT dynamiquem [HTML/JS] - HTML/CSS - Programmation

Marsh Posté le 17-04-2005 à 15:23:51    

Bonjour,
 
je voudrais pouvoir changer la couleur de fond d'un rectangle sur une page afin de donner un aperçu d'un choix de couleur à l'utilisateur. Le rectangle peut être n'importe quoi : DIV, INPUT, etc. Je pensais modifier la propriété style de l'objet de cette façon :
 

Code :
  1. document.formulaire.exemple.style = "background: #" colorvalue;


 
cependant cela ne fonctionne pas.
 
Une idée ??
 
Merci :)

Reply

Marsh Posté le 17-04-2005 à 15:23:51   

Reply

Marsh Posté le 17-04-2005 à 15:32:34    

document.getElementById("id_de_l'element" ).style.background-color="#couleur";


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 17-04-2005 à 15:45:23    

merci :)

Reply

Marsh Posté le 18-04-2005 à 18:57:17    

masklinn a écrit :

document.getElementById("id_de_l'element" ).style.backgroundColor="#couleur";


[:aloy]


Message édité par cerel le 18-04-2005 à 18:57:45
Reply

Marsh Posté le 18-04-2005 à 19:46:04    


Merde, encore oublié ça [:jofusion]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed