Changer l'opacité d'une image

jacque99 Messages postés 6 Date d'inscription lundi 20 septembre 2010 Statut Membre Dernière intervention 6 octobre 2010 - 7 sept. 2010 à 11:15
omarino_007 Messages postés 24 Date d'inscription mardi 7 mars 2006 Statut Membre Dernière intervention 27 décembre 2010 - 8 sept. 2010 à 15:58
Bonjour tout le monde,
J'ai un script pour changer l'opacité d'une image en JavaScript.
il marche bien sur Firefox et non pas sur Internet Explorer je demande si vous avez des modifications à faire pour qu'il marche ou si quelqu'un à un lien
Merci
Voici mon script index.html




<!------------------------------------------------index.html------------------------------------------------>


<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Changer l'opacité d'un élément en javascript</title>


<script type="text/javascript">
function set_opacity(id, opacity)
{
el = document.getElementById(id);
el.style["filter"] = "alpha(opacity="+opacity+")";
el.style["-moz-opacity"] = opacity/100;
el.style["-khtml-opacity"] = opacity/100;
el.style["opacity"] = opacity/100;
return true;
}
</script>

<STYLE TYPE="text/css">
body
.bloc
{
text-align:center;
width:190px;
border:1px solid black;
background-color:#E0E0E0;
float:left;
margin:10px;
padding:5px;
}
.pct
{
font-size:28px;
}
</STYLE>

</head>










<script type="text/javascript">
//<!--
set_opacity('bloc3',30);
//-->
</script>




</html>

<!-------------------------------------------fin page index.html------------------------------------------->

2 réponses

Raul duke Messages postés 70 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 17 mai 2019 2
8 sept. 2010 à 15:56
ça fonctionne sur I.E8 en tout cas
0
omarino_007 Messages postés 24 Date d'inscription mardi 7 mars 2006 Statut Membre Dernière intervention 27 décembre 2010
8 sept. 2010 à 15:58
Tu devrai peut être poser ta question dans le forum JS
0
Rejoignez-nous