Code HTML Pour le fond de ma page
Résolu
Utilisateur anonyme
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
Je cherche un code html pour que les visiteurs de ma page puisse modifier ma page de couleur
Ex sur msn il y a 4ou5 bouton qui permette de modifier la couleur du site.
Merci
Je cherche un code html pour que les visiteurs de ma page puisse modifier ma page de couleur
Ex sur msn il y a 4ou5 bouton qui permette de modifier la couleur du site.
Merci
A voir également:
- Code HTML Pour le fond de ma page
- Code ascii - Guide
- Impossible de supprimer une page word - Guide
- Comment déverrouiller un téléphone quand on a oublié le code - Guide
- Fond de page word - Guide
- Code puk bloqué - Guide
4 réponses
bonjour,
en javascript enfin je lé jamais fait mais je vais essayer de t'aider :
c'est dans la balise <BODY> que ça se passe
<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>
en javascript enfin je lé jamais fait mais je vais essayer de t'aider :
c'est dans la balise <BODY> que ça se passe
<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>
Essaye avec l'objet getElementbyId plus d'info ici https://openclassrooms.com/fr/courses t'as juste a récupérer la valeur du formulaire pour le mettre dans le contenu
de ce genre :
function jaune;
{
document.getElementById('{id du div}').style.backgroundColor = 'yellow';
}
le problème ce que ça va s'appliquer qu'a un seul div
de ce genre :
function jaune;
{
document.getElementById('{id du div}').style.backgroundColor = 'yellow';
}
le problème ce que ça va s'appliquer qu'a un seul div