|
<script language="JavaScript">
<!--
//PLF-http://www.jejavascript.net/
var x = 0;
var y = 0;
var dist=-145
var distg=-145
var distd=75
var vit=10
var total=0
var mess
var posX = 0;
var posY = 0;
var animate = true;
var imag1 = "im/souris/gauche.gif";
if (document.getElementById)
{
if(navigator.appName.substring(0,3) == "Net")
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = Pos_Souris;
window.onload = depl_img;
}
function Pos_Souris(p)
{
x = (navigator.appName.substring(0,3) == "Net")
? p.pageX : event.x+document.body.scrollLeft;
y = (navigator.appName.substring(0,3) == "Net")
? p.pageY : event.y+document.body.scrollTop;
}
function clickok()
{
total++;
mess="BRAVO! Tu m'as eu "+total+" fois. Essaye
encore si tu peux.";
alert(mess);
distg -= 10;
distd += 10;
if (vit > 5) vit--;
}
function depl_img()
{
if (document.getElementById && animate)
{
document.getElementById("idjoe").style.top = posY-40;
document.getElementById("idjoe").style.left =
posX+dist;
vitess = setTimeout("depl_img()",10)
posX = posX+(((x-posX)+10)/vit);
posY = posY+(((y-posY)+10)/vit);
if(posX+dist<x){
imag2='im/souris/droite.gif';
dist=distg
}
else{
imag2='im/souris/gauche.gif';
dist=distd
}
if(imag2!=imag1)
{
document.joe.src=imag2;
imag1=imag2;
}
}
}
if(document.getElementById)
{
document.write('<DIV ID=idjoe style="position: absolute">');
document.write('<A HREF="#" onClick="clickok();">');
document.write('<IMG SRC="im/souris/droite.gif"
name=joe border=0 hspace=0 vspace=0 ></A></DIV>');
}
//-->
</script>
|