|
|
|
|
Posté par
Maxence, le mercredi 11 avril 2007 à 15:25:45Configuration: Windows XP Firefox 2.0.0.3
Salut,
http://www.toutjavascript.com/main/gorun.php3?s=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... |
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 ... ;) |
Salut!
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 |
| 10/01 16h39 | [FreeMind] Publier une mindmap dans une page web | Webmaster |
| 24/01 16h52 | Les balises metas dans le code source | Référencement |
| 05/11 11h52 | [Javascript] Effacer un champ de formulaire lors du clic (focus) | Javascript |
| 03/04 17h28 | On peut cacher le code source d'une page HTML | Mythes et légendes |
| 05/11 11h45 | [Javascript] Date de dernière modification | Javascript |
| 23/08 11h50 | [html/javascript] Tableau dynamique scrollabl | 0 |
| 07/02 14h16 | [html, javascript] menu dynamique | 4 |
| 28/05 11h03 | [JAVASCRIPT HTML] javascript appelant du html | 4 |
| 18/04 17h14 | Page html avec un fond qui bouge | 7 |
![]() | Firstpage - First Page 2006 est un éditeur html gratuit et excellent. Il permet de travailler un code HTML en couleur, ainsi que de... | Catégorie: Editeurs HTML Licence: Freeware/gratuit |
![]() | HTML Tidy - HTML Tidy est un utilitaire permettant de vérifier et d'optimiser tout code HTML. La version originale de cet utilitaire... | Catégorie: Webmaster Licence: Freeware/gratuit |
![]() | HTMLDOC - HTMLDOC est un outil permettant de convertir une page HTML (Hyper-Text Markup Language) vers un fichier HTML indexé, vers... | Catégorie: PDF Licence: Freeware/gratuit |
![]() | GreaseMonkey - GreaseMonkey permet de bidouiller à la volée les pages web que vous consultez. C'est à dire qu'il va modifier la page... | Catégorie: Extensions Firefox Licence: Open Source |
![]() | Lapin Malin (Les Formes | Catégorie: Jeu vidéo PC | |
![]() | 2000 Textures Et Fonds | Catégorie: Jeu vidéo PC | |
![]() | Lapin Malin: Les Formes | Catégorie: Jeu vidéo PC | |
![]() | Drolement Futes: Je Decouvre | Catégorie: Jeu vidéo PC |