A voir également:
- [HTML/JavaScript] Couleur de fond dynamique
- [HTML/Javascript] attribut value dynamique ✓ - Forum - Javascript
- Couleur de fond sur page html ✓ - Forum - HTML
- Balise html couleur de fond ✓ - Forum - HTML
- Mettre une couleur de fond html - Forum - HTML
- Changer la couleur du fond d'écran windows 10 - Guide
5 réponses
HackTrack
15 avril 2007 à 13:50
- Messages postés
- 618
- Date d'inscription
- vendredi 26 juillet 2002
- Statut
- Membre
- Dernière intervention
- 13 juillet 2013
15 avril 2007 à 13:50
Salut!
Voici le code qui te permet de faire cela:
;-)
HackTrack
Voici le code qui te permet de faire cela:
<html> <!-- Author: HackTrack --> <head> <title>Démo de sélection de couleur de fond</title> <script language="javascript" type="text/javascript"> function changeBackgroundColor(elm){ window.status=elm.style.backgroundColor; document.body.style.backgroundColor=elm.style.backgroundColor; } </script> <style> table, tr, td{ margin: 0px; padding:0px; border: solid 1px #0f0f0f; } div{ width: 50px; height: 50px; } </style> </head> <body> <table> <tr> <th colspan="4">Choisissez la couleur de fond</th> </tr> <tr> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #000000;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #111111;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #222222;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #333333;"></div></td> </tr> <tr> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #444444;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #555555;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #666666;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #777777;"></div></td> </tr> <tr> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #888888;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #999999;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #aaaaaa;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #bbbbbb;"></div></td> </tr> <tr> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #cccccc;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #dddddd;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #eeeeee;"></div></td> <td><div onclick="javascript: changeBackgroundColor(this);" style="background-color: #ffffff;"></div></td> </tr> </table> </body> </html>
;-)
HackTrack
xjl
11 avril 2007 à 15:53
- Messages postés
- 232
- Date d'inscription
- mardi 27 mars 2007
- Statut
- Membre
- Dernière intervention
- 12 juin 2007
11 avril 2007 à 15:53
Salut,
https://www.toutjavascript.com/main/script.php?url=chpcolor
Si tu t'y connais un peu en javascript, tu pourras sûrement adapter ce script prévu pour changer la couleur de fond d'un cadre en fonction de la valeur d'un champ texte...
Fondamentalement, ça doit marcher pareil que ce que tu veux faire, enfin je pense...
https://www.toutjavascript.com/main/script.php?url=chpcolor
Si tu t'y connais un peu en javascript, tu pourras sûrement adapter ce script prévu pour changer la couleur de fond d'un cadre en fonction de la valeur d'un champ texte...
Fondamentalement, ça doit marcher pareil que ce que tu veux faire, enfin je pense...
BenjD90
27 oct. 2008 à 13:23
- Messages postés
- 83
- Date d'inscription
- samedi 23 février 2008
- Statut
- Membre
- Dernière intervention
- 20 avril 2011
27 oct. 2008 à 13:23
Merci, c super ton code, simple, pile ce que je cherchais, c bête qu'il ne soit pas mis plus en avant
Sait tu comment on fait la même chose avec une image de fond (changeBackgroundimage(this) ou changeBackgroundImage(this) ne marchent pas)
Sait tu comment on fait la même chose avec une image de fond (changeBackgroundimage(this) ou changeBackgroundImage(this) ne marchent pas)
Et bien merci tout d'abord ...
Mais par contre, je m'y connais un peu en JavaScript et ce truc ne m'aide pas trop trop ... :s
En fait j'avais vu un truc du genre on choisi parmi un menu defilant une couleur et hop le fond de la page prend cette couleur mais ca non plus ca m'aidait pas donc j'aurais vraiment besoin d'une aide ciblée si possible :) ...
En tout cas merci a toi :)
PS : je vais quand meme regarder en profondeur ce code ... ;)
Mais par contre, je m'y connais un peu en JavaScript et ce truc ne m'aide pas trop trop ... :s
En fait j'avais vu un truc du genre on choisi parmi un menu defilant une couleur et hop le fond de la page prend cette couleur mais ca non plus ca m'aidait pas donc j'aurais vraiment besoin d'une aide ciblée si possible :) ...
En tout cas merci a toi :)
PS : je vais quand meme regarder en profondeur ce code ... ;)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
n'étant pas un pro du html, je ne peux pas t'indiquer les balises, mais je pense qu'il est possible de faire quelque chose du genre:
un clic sur la couleur définit une variable, que tu utilises ensuite pour définir la couleur de ta page...
j'espère que ceci t'aidera au moins un peu
un clic sur la couleur définit une variable, que tu utilises ensuite pour définir la couleur de ta page...
j'espère que ceci t'aidera au moins un peu
prosthetiks
20 oct. 2014 à 22:47
- Messages postés
- 1189
- Date d'inscription
- dimanche 7 octobre 2007
- Statut
- Membre
- Dernière intervention
- 12 juin 2020
20 oct. 2014 à 22:47
Déterrage de topic en vue ! Après 4 ans de silence, le revoilà en tête de liste. Etait-ce vraiment nécessaire ?
27 nov. 2008 à 06:59
18 août 2010 à 12:18
24 juil. 2012 à 09:30