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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<html>
<head>
<title></title>
<style type="text/css">
<!--
#Bulle{
width: 160px;
display: none;
position: absolute;
z-index : 1;
background-color: #F4F49C;
padding: 2px;
margin: 2px;
border-style: ridge;
border-width: 3px;
border-color: #F4F49C;
font-family: Arial;
font-size: 8pt;
text-align: center;
}
//-->
</style>
<script type="text/javascript">
<!--
function MouseOver(ev, msg)
{
var Xdoc, Xfen, Ydoc, Yfen, htDiv, lgDiv, dX, dY;
var Ybulle;
var el=document.getElementById("Bulle");
//on affiche la boite de dialogue pour evaluer ses dimensions.
if (el.style.display!="inline")
el.style.display="inline";
//hauteur et largeur de la bulle
htDiv = el.offsetHeight;
lgDiv = el.offsetWidth;
//delta de la bulle sous la souris
dY=10;
dX=10;
//position de la souris :
Xfen = ev.clientX;
Xdoc = Xfen + document.body.scrollLeft;
Yfen = ev.clientY;
Ydoc = Yfen + document.body.scrollTop;
//position de la bulle dans la page :
if ((Xfen + lgDiv + dX) > document.body.clientWidth)
el.style.left = document.body.clientWidth + document.body.scrollLeft - lgDiv;
else
el.style.left = Xdoc + dX;
if ((Yfen + htDiv + dY) > document.body.clientHeight)
{
Ybulle = document.body.clientHeight + document.body.scrollTop - htDiv-5;
if (parseInt(Ybulle)>parseInt(Ydoc))
{
el.style.top = Ybulle;
}
else
{
el.style.top = Ydoc - htDiv-dY;
}
}
else
{
el.style.top = Ydoc + dY-5;
}
//contenu de la bulle :
el.innerHTML = msg;
}
function MouseOut()
{
//on cache la bulle
document.getElementById("Bulle").style.display = "none";
}
//-->
</script>
</head>
<body>
<div id="Bulle">Mon info-bulle</div>
<a onmouseover="MouseOver(event, 'Mon joli message !')" onmouseout="MouseOut()">Mon lien 1</a>
<br><br><br>
<a onmouseover="MouseOver(event, 'Mon très très joli message !')" onmouseout="MouseOut()">Mon lien 2</a>
</body>
</html> |
Partager