Trucsweb.com

Forum de discussion

 Forum « Programmation Javascript » (archives)

Erreur de script

Envoyé: 7 juin 2004, 9h49 par anov


Est ce que vous pourriez m'aidez a corriger les fautes de ce script je n'y arrive pas tout seul. Merci d'avance. Les erreurs ne sont pas sur le menu flottant,elle sont sur le reste. Merci d'avance.


<HTML>
<HEAD>
<script language="JavaScript">
<!--
var coeff=2;//Coefficient de reduction
var larg=70;//largeur maxi de l'image
var haut=70;//hauteur maxi de l'image
function changer(sel) {
switch(sel){
case 1 : //image 1
if (document.image1.width < larg) {
coeff = coeff-0.2;
document.image1.width = Math.round(larg/coeff);
document.image1.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(1);',1);//vitesse de l'effet
}
break;
case 2 : //image 2
if (document.image2.width < larg) {
coeff = coeff-0.1;
document.image2.width = Math.round(larg/coeff);
document.image2.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(2);',1);//vitesse de l'effet
}
break;
case 3 : //image 3
if (document.image3.width < larg) {
coeff = coeff-0.1;
document.image3.width = Math.round(larg/coeff);
document.image3.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(3);',1);//vitesse de l'effet
}
break;
case 4 : //image 3
if (document.image4.width < larg) {
coeff = coeff-0.1;
document.image4.width = Math.round(larg/coeff);
document.image4.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(4);',1);//vitesse de l'effet
}
break;
case 5 : //image 3
if (document.image5.width < larg) {
coeff = coeff-0.1;
document.image5.width = Math.round(larg/coeff);
document.image5.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(5);',1);//vitesse de l'effet
}
break;
case 6 : //image 3
if (document.image6.width < larg) {
coeff = coeff-0.1;
document.image6.width = Math.round(larg/coeff);
document.image6.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(6);',1);//vitesse de l'effet
}
break;
case 7 : //image 3
if (document.image7.width < larg) {
coeff = coeff-0.1;
document.image7.width = Math.round(larg/coeff);
document.image7.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(7);',1);//vitesse de l'effet
}
break;
case 8 : //image 3
if (document.image8.width < larg) {
coeff = coeff-0.1;
document.image8.width = Math.round(larg/coeff);
document.image8.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(8);',1);//vitesse de l'effet
}
break;
case 9 : //image 3
if (document.image9.width < larg) {
coeff = coeff-0.1;
document.image9.width = Math.round(larg/coeff);
document.image9.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(9);',1);//vitesse de l'effet
}
break;
case 10 : //image 3
if (document.image10.width < larg) {
coeff = coeff-0.1;
document.image10.width = Math.round(larg/coeff);
document.image10.height = Math.round(haut/coeff);
chang=window.setTimeout('changer(10);',1);//vitesse de l'effet
}
break;
//images suivantes ...
}
if (document.image10.width >= larg) window.clearTimeout(chang);
}
function initial(sel) {
switch(sel){
case 1 : //image 1
if (document.image1.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image1.width = Math.round(larg/coeff);
document.image1.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(1);',1);//vitesse de l'effet
}
break;
case 2 : //image 2
if (document.image2.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image2.width = Math.round(larg/coeff);
document.image2.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(2);',1);//vitesse de l'effet
}
break;
case 3 : //image 3
if (document.image3.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image3.width = Math.round(larg/coeff);
document.image3.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(3);',1);//vitesse de l'effet
}
break;
case 4 : //image 3
if (document.image4.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image4.width = Math.round(larg/coeff);
document.image4.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(4);',1);//vitesse de l'effet
}
break;
case 5 : //image 3
if (document.image5.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image5.width = Math.round(larg/coeff);
document.image5.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(5);',1);//vitesse de l'effet
}
break;
case 6 : //image 3
if (document.image6.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image6.width = Math.round(larg/coeff);
document.image6.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(6);',1);//vitesse de l'effet
}
break;
case 7 : //image 3
if (document.image7.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image7.width = Math.round(larg/coeff);
document.image7.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(7);',1);//vitesse de l'effet
}
break;
case 8 : //image 3
if (document.image8.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image8.width = Math.round(larg/coeff);
document.image8.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(8);',1);//vitesse de l'effet
}
break;
case 9 : //image 3
if (document.image9.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image9.width = Math.round(larg/coeff);
document.image9.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(9);',1);//vitesse de l'effet
}
break;
case 10 : //image 3
if (document.image10.width > larg/2) {
window.clearTimeout(chang);
coeff = coeff+0.2;
document.image10.width = Math.round(larg/coeff);
document.image10.height = Math.round(haut/coeff);
initi=window.setTimeout('initial(10);',1);//vitesse de l'effet
}
break;
//images suivantes ...
}
if (document.image1.width < larg/2) window.clearTimeout(initi);
}
//-->
</script>






<TITLE></TITLE>
</HEAD>
<BODY>
<div align="center">
<p>
<script language="JavaScript">
<!--
document.image2.width = Math.round(larg/coeff);
document.image2.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image3.width = Math.round(larg/coeff);
document.image3.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image4.width = Math.round(larg/coeff);
document.image4.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image5.width = Math.round(larg/coeff);
document.image5.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image6.width = Math.round(larg/coeff);
document.image6.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image7.width = Math.round(larg/coeff);
document.image7.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image8.width = Math.round(larg/coeff);
document.image8.height = Math.round(haut/coeff);
//-->
</script>
<script language="JavaScript">
<!--
document.image9.width = Math.round(larg/coeff);
document.image9.height = Math.round(haut/coeff);
//-->
</script>
</p>
<div align="left"></div>
<div align="left"></div>
<p>
<script language="JavaScript">
<!--
document.image10.width = Math.round(larg/coeff);
document.image10.height = Math.round(haut/coeff);
//-->
</script>
</p>
</div>
</div>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>

<p align="center">



<SCRIPT>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</SCRIPT>
<LAYER name="divStayTopLeft" left="41" top="55" z-index="0" width="300" height="50" bgcolor="#000000" id=divStayTopLeft>
<div align="left"><a href="index.php?mod=page&ac=Team" onMouseOut="initial(2)" onMouseOver="changer(2)" ><img src="logo/team.gif" alt="Team" name="image2" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Photos" onMouseOut="initial(3)" onMouseOver="changer(3)" ><img src="logo/image.gif" alt="Photos" name="image3" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Videos1" onMouseOut="initial(4)" onMouseOver="changer(4)" ><img src="logo/video.gif" alt="Vidéos" name="image4" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Jeux" onMouseOut="initial(5)" onMouseOver="changer(5)" ><img src="logo/jeu.gif" alt="Jeux" name="image5" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Diaporamas" onMouseOut="initial(6)" onMouseOver="changer(6)" ><img src="logo/diapo.gif" alt="Diaporamas" name="image6" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Blagues" onMouseOut="initial(7)" onMouseOver="changer(7)" ><img src="logo/blagues.gif" alt="Blagues" name="image7" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=page&ac=Contacts" onMouseOut="initial(8)" onMouseOver="changer(8)" ><img src="logo/mail.gif" alt="Contacts" name="image8" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=livredor" onMouseOut="initial(9)" onMouseOver="changer(9)" ><img src="logo/livredor.gif" alt="Livre d'or" name="image9" width="35" height="35" hspace="10" border="0" align="left"></a><a href="index.php?mod=forum" onMouseOut="initial(10)" onMouseOver="changer(10)" ><img src="logo/forum.gif" alt="Forum" name="image10" width="35" height="35" hspace="10" border="0" align="left"></a>
<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<!--END OF EDIT-->
</div>
</LAYER>
<p>
<SCRIPT type=text/javascript>

/*
Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 265,
startY = 70;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</SCRIPT>


</BODY>
</HTML>


Réponses

 sp spRe: Erreur de script Oznog10/6/2004
Aucun médias sociaux
X

Trucsweb.com Connexion

Connexion

X

Trucsweb.com Mot de passe perdu

Connexion

X

Trucsweb.com Conditions générales

Conditions

Responsabilité

La responsabilité des Trucsweb.com ne pourra être engagée en cas de faits indépendants de sa volonté. Les informations mises à disposition sur ce site le sont uniquement à titre purement informatif et ne sauraient constituer en aucun cas un conseil ou une recommandation de quelque nature que ce soit.

Aucun contrôle n'est exercé sur les références et ressources externes, l'utilisateur reconnaît que les Trucsweb.com n'assume aucune responsabilité relative à la mise à disposition de ces ressources, et ne peut être tenue responsable quant à leur contenu.

Droit applicable et juridiction compétente

Les règles en matière de droit, applicables aux contenus et aux transmissions de données sur et autour du site, sont déterminées par la loi canadienne. En cas de litige, n'ayant pu faire l'objet d'un accord à l'amiable, seuls les tribunaux canadien sont compétents.

X

Trucsweb.com Trucsweb

X

Trucsweb.com Glossaire

X

Trucsweb.com Trucsweb

X

Trucsweb.com Trucsweb

Conditions

Aucun message!

Merci.

X
Aucun message!
X

Trucsweb.com Créer un compte

Créer un compte

.
@