Passage paramètre / setStyle
bonjour,
Ca fait 2 jours que je tourne en rond alors j'ai besoin d'aide.
J'ai recopié les 2 scripts
- camelize qui enlève les tirets par ex : background-color devient backgroundColor
- setStyle
provenant des librairies Prototype.js dans mon <head> et ajouté la ligne en gras pour ajouter la fonction cameliz comme une extension de l'objet String. Je voulais ensuite en cliquant sur le bouton que j'ai défini changer le background avec setStyle. Ca ne marche pas.
Voir post dans mon 2è message pour le code
Merci
utilisation librairie prototype
En fait, même ce simple code utilisant la librairie prototype ne fonctionne pas.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Site</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<script src="prototype.js" type="text/javascript"></script>
</head>
<body>
<div id="body">
<h1>Site</h1>
<img alt="Page en construction" src="accueil.jpg" />
</div>
<div>
<input type="button" onclick="setStyle('body', {background-color: 'grey'});" value ="Griser" />
</div>
</body>
</html> |