1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <!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="fr" >
<head>
<title>Test</title>
<script type="text/javascript">
var IsIE=!!document.all;
function init(){
for(var i=0;i<document.getElementsByTagName('area').length;i++){
if(IsIE){
document.getElementById('cache'+i).style.filter='alpha(opacity=0)';
document.getElementById('cache'+i).filters[0].opacity=0;
}
else{document.getElementById('cache'+i).style.opacity='0';}
}
}
function setop(elt,nb){
if(IsIE){
elt.style.filter='alpha(opacity='+nb*100+')';
elt.filters[0].opacity=nb*100;
}
else{elt.style.opacity=nb;}
}
</script>
</head>
<body onload="init()">
<map id="ma_map" name="ma_map">
<area shape="rect" id="area0" coords="0,0,200,200" href="http://www.developpez.net/forums/d616349/webmasters-developpement-web/javascript/rendre-transparente-partie-image/#post3641869" alt="lien" />
</map>
<img src="image672x400.jpg" usemap="#ma_map" style="border:none" height="400" width="672" alt="image" />
<div id="cache0" style="background-color:white;position:relative;top:-400px;left:0;width:200px;height:200px;cursor:pointer" onclick="location.href=document.getElementById('area0').href" onmouseover="setop(this,0.6)" onmouseout="setop(this,0)"></div>
</div>
</body>
</html> |
Partager