<!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" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
ALGO2 TP TEST
</title>
<style type="text/css">
body
{
background-color : #fff ;
}
</style>
<script type="text/javascript">
// <![CDATA[
var posx_cadre=50;
var posy_cadre=50;
var largeur_cadre=220;
var hauteur_cadre=120;
var ouverture_x=200;
var ouverture_y=100;
var vitesse=1;
var pas=1;
function ouverture ()
{
var position;
var hauteur_max=
10+parseInt(ouverture_y)+parseInt(hauteur_cadre);
position =
parseInt(document.getElementById("bhb").style.top)
;
position += vitesse;
document.getElementById("cbg").style.top=positi
on+("px");
document.getElementById("bhb").style.top=positi
on+("px");
document.getElementById("cbd").style.top=positi
on+("px");
document.getElementById("bvg").style.height=(po
sition-posy_cadre)+("px");
document.getElementById("bvd").style.height=(po
sition-posy_cadre)+("px");
document.getElementById("fond").style.height=(p
osition-posy_cadre)+("px");
if(position<hauteur_max)
{
setTimeout("ouverture()",pas);
}
else
{
document.getElementById("bhb").onclick=fermetu
re;
}
}
function fermeture ()
{
var position;
var hauteur_min=
10+parseInt(hauteur_cadre)+parseInt(posy_cadre);
position =
parseInt(document.getElementById("bhb").style.top)
;
position -= vitesse;
document.getElementById("cbg").style.top=positi
on+("px");
document.getElementById("bhb").style.top=positi
on+("px");
document.getElementById("cbd").style.top=positi
on+("px");
document.getElementById("bvg").style.height=(po
sition-posy_cadre)+("px");
document.getElementById("bvd").style.height=(po
sition-posy_cadre)+("px");
document.getElementById("fond").style.height=(p
osition-posy_cadre)+("px");
if(position>hauteur_min)
{
setTimeout("fermeture()",pas);
}
else
{
document.getElementById("bhb").onclick=ouvertu
re;
}
}
function grossir()
{
var position;
var grosseur_max=
10+parseInt(ouverture_x)+parseInt(largeur_cadre);
position =
parseInt(document.getElementById("bvd").style.left
);
position += vitesse;
document.getElementById("chd").style.left=posit
ion+("px");
document.getElementById("bvd").style.left=posit
ion+("px");
document.getElementById("cbd").style.left=posit
ion+("px");
document.getElementById("bhb").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("bhh").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("fond").style.width=(po
sition-posx_cadre)+("px");
if(position<grosseur_max)
{
setTimeout("grossir()",pas);
}
else
{
document.getElementById("bvd").onclick=maigrir
;
}
}
function maigrir()
{
var position;
var grosseur_min= 10+parseInt(posx_cadre)+parseInt(largeur_cadre);
position =
parseInt(document.getElementById("bvd").style.left
);
position -= vitesse;
document.getElementById("chd").style.left=posit
ion+("px");
document.getElementById("bvd").style.left=posit
ion+("px");
document.getElementById("cbd").style.left=posit
ion+("px");
document.getElementById("bhb").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("bhh").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("fond").style.width=(po
sition-posx_cadre)+("px");
if(position>grosseur_min)
{
setTimeout("maigrir()",pas);
}
else
{
document.getElementById("bvd").onclick=grossir
;
}
}
function grand()
{
var position_x;
var position_y;
var grosseur_max=
10+parseInt(ouverture_x)+parseInt(largeur_cadre);
var hauteur_max=
10+parseInt(ouverture_y)+parseInt(hauteur_cadre);
position_x =
parseInt(document.getElementById("bvd").style.left
);
position_y =
parseInt(document.getElementById("bhb").style.top)
;
position_y += vitesse;
position_x += vitesse;
//***** grossissement *****//
document.getElementById("chd").style.left=posit
ion_x+("px");
document.getElementById("bvd").style.left=posit
ion_x+("px");
document.getElementById("cbd").style.left=posit
ion_x+("px");
document.getElementById("bhb").style.width=(pos
ition_x-posx_cadre)+("px");
document.getElementById("bhh").style.width=(pos
ition_x-posx_cadre)+("px");
document.getElementById("fond").style.width=(po
sition_x-posx_cadre)+("px");
if(position_y<hauteur_max)
{
//***** agrandissement *****//
document.getElementById("cbg").style.top=positi
on_y+("px");
document.getElementById("bhb").style.top=positi
on_y+("px");
document.getElementById("cbd").style.top=positi
on_y+("px");
document.getElementById("bvg").style.height=(po
sition_y-posy_cadre)+("px");
document.getElementById("bvd").style.height=(po
sition_y-posy_cadre)+("px");
document.getElementById("fond").style.height=(p
osition_y-posy_cadre)+("px");
}
if(position_x<grosseur_max)
{
setTimeout("grand()",pas);
}
else
{
document.getElementById("cbd").onclick=petit;
}
}
function petit()
{
var position_x;
var position_y;
var grosseur_min= 10+parseInt(posx_cadre)+parseInt(largeur_cadre);
var hauteur_min= 10+parseInt(hauteur_cadre)+parseInt(posy_cadre);
position_x =
parseInt(document.getElementById("bvd").style.left
);
position_y =
parseInt(document.getElementById("bhb").style.top)
;
position_y -= vitesse;
position_x -= vitesse;
//***** grossissement *****//
document.getElementById("chd").style.left=posit
ion_x+("px");
document.getElementById("bvd").style.left=posit
ion_x+("px");
document.getElementById("cbd").style.left=posit
ion_x+("px");
document.getElementById("bhb").style.width=(pos
ition_x-posx_cadre)+("px");
document.getElementById("bhh").style.width=(pos
ition_x-posx_cadre)+("px");
document.getElementById("fond").style.width=(po
sition_x-posx_cadre)+("px");
if(position_y>hauteur_min)
{
//***** agrandissement *****//
document.getElementById("cbg").style.top=positi
on_y+("px");
document.getElementById("bhb").style.top=positi
on_y+("px");
document.getElementById("cbd").style.top=positi
on_y+("px");
document.getElementById("bvg").style.height=(po
sition_y-posy_cadre)+("px");
document.getElementById("bvd").style.height=(po
sition_y-posy_cadre)+("px");
document.getElementById("fond").style.height=(p
osition_y-posy_cadre)+("px");
}
if(position_x>grosseur_min)
{
setTimeout("petit()",pas);
}
else
{
document.getElementById("cbd").onclick=grand;
}
}
function repositionne()
{
document.getElementById("fond").style.left=posi
tion+("px");
document.getElementById("chg").style.left=posit
ion+("px");
document.getElementById("bhh").style.left=posit
ion+("px");
document.getElementById("chd").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("bvg").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("bvd").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("cbg").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("bvb").style.width=(pos
ition-posx_cadre)+("px");
document.getElementById("cbd").style.width=(pos
ition-posx_cadre)+("px");
}
//]]>
</script>
</head>
<body>
<script type="text/javascript">
// <![CDATA[
document.write ('<img id="fond" alt="" src="img/fond.gif" style="position:absolute; left:'+posx_cadre+'px; top:'+posy_cadre+'px; width:'+(largeur_cadre+10)+'px; height:'+(hauteur_cadre+10)+'px;" />');
document.write ('<img id="chg" alt="" src="img/chg.gif" style="position:absolute; left:'+posx_cadre+'px; top:'+posy_cadre+'px; width:10px; height: 10px;" />');
document.write ('<img id="bhh" alt="" src="img/bh.gif" style="position:absolute; left:'+(posx_cadre+10)+'px; top:'+posy_cadre+'px; width:'+largeur_cadre+'px; height: 10px;" />');
document.write ('<img id="chd" alt="" src="img/chd.gif" style="position:absolute; left:'+(posx_cadre+10+largeur_cadre)+'px; top:'+posy_cadre+'px; width:10px; height: 10px;" />');
document.write ('<img id="bvg" alt="" src="img/bv.gif" style="position:absolute; left:'+posx_cadre+'px; top:'+(posy_cadre+10)+'px; width:10px; height:'+hauteur_cadre+'px;" />');
document.write ('<img id="bvd" alt="" src="img/bv.gif" style="position:absolute; left:'+(posx_cadre+largeur_cadre+10)+'px; top:'+(posy_cadre+10)+'px; width:10px; height: '+hauteur_cadre+'px;" onclick="grossir()"/>');
document.write ('<img id="cbg" alt="" src="img/cbg.gif" style="position:absolute; left:'+posx_cadre+'px; top:'+(posy_cadre+hauteur_cadre+10)+'px; width:10px; height: 10px;" />');
document.write ('<img id="bhb" alt="" src="img/bh.gif" style="position:absolute; left:'+(posx_cadre+10)+'px; top:'+(posy_cadre+hauteur_cadre+10)+'px; width:'+largeur_cadre+'px; height:10px;" onclick="ouverture()"/>');
document.write ('<img id="cbd" alt="" src="img/cbd.gif" style="position:absolute; left:'+(posx_cadre+largeur_cadre+10)+'px; top:'+(posy_cadre+hauteur_cadre+10)+'px; width:10px; height: 10px;" onclick="grand()"/>');
document.write ('<input id="LeftUtil" type="text" value="" style="position:absolute; top:'+(posy_cadre+20)+'px; left:'+(posx_cadre+20)+'px;" size="10" />');
document.write ('<input id="TopUtil" type="text" value="" style="position:absolute; top:'+(posy_cadre+60)+'px; left:'+(posx_cadre+20)+'px;" size="10" />');
document.write ('<input type="button" value="Positionner" style="position:absolute; top:'+(posy_cadre+100)+'px; left:'+(posx_cadre+20)+'px;" size="10" onclick="repositionne()" />');
document.write ('<img id="image" alt="" src="img/chien.jpg" style="position:absolute; left:'+(posy_cadre+130)+'px; top:'+(posy_cadre+20)+'px; width:90px; height: 100px;" />');
//]]>
</script>
</body>
</html>