rss
Rechercher : dans
Par : Pertinence Date Nom d'utilisateur
Statut : Non résolu

Code javascript sous IE

Posté par magickirua, le vendredi 23 novembre 2007 à 18:43:59
Bonjour,
J'ai un code en javascript qui fonctionne sur Firefox mais pas sur IE.
C'est simplement un code qui change d'image en fonction d'une valeur. Et donc, comment faire pour que ça fonctionne sur les deux?
Merci d'avance!

<html>
<head>
<title>Sabliers</title>

<style type="text/css">
table{ margin-left:auto;margin-right:auto;width:300px;}
td { text-align:center; font-family:Georgia; font-size:xx-large; }
td.gryffondor{ color:#FF3300; height:50px; }
td.serdaigle{ color:#3366CC; height:50px; }
td.poufsouffle{ color:#CCFF33; height:50px; }
td.serpentard{ color:#33CC33; height:50px; }
</style>

<script language="JavaScript" type="text/javascript">

function sabliers()
{
var table,tr,td,body,i,j;
body=document.getElementsByTagName("BODY")[0];­
table=document.createElement("TABLE");
table.cellSpacing=0;
table.cellPadding=0;

for(i=0;i<2;i++)
{
tr=document.createElement("TR");



for(j=0;j<4;j++)
{
if (i==1)
{
td=document.createElement("TD");
p=document.createElement("P");
img=document.createElement("img");
if(j==0)
{gryf=document.getElementById(1);

if (gryf.value<=300){ img.src="http://i16.tinypic.com/6odltm0.jpg"; }
if (gryf.value>300 && gryf.value<=600){ img.src="http://i12.tinypic.com/6y0s6pv.jpg"; }
if (gryf.value>600 && gryf.value<=900){ img.src="http://i14.tinypic.com/7wsdhyx.jpg"; }
if (gryf.value>900 && gryf.value<=1200){ img.src="http://i9.tinypic.com/7y2n8u8.jpg"; }
if (gryf.value>1200 && gryf.value<=1500){ img.src="http://i18.tinypic.com/6wo2yb9.jpg"; }
if (gryf.value>1500 && gryf.value<=1800){ img.src="http://i16.tinypic.com/6wrpvm0.jpg"; }
if (gryf.value>1800){ img.src="http://i9.tinypic.com/8fw8rjk.jpg"; }
}
if(j==1)
{
serd=document.getElementById(2);

if (serd.value<=300){ img.src="http://i10.tinypic.com/6pefwqp.jpg"; }
if (serd.value>300 && serd.value<=600){ img.src="http://i16.tinypic.com/6l17shy.jpg"; }
if (serd.value>600 && serd.value<=900){ img.src="http://i11.tinypic.com/6lcuh5f.jpg"; }
if (serd.value>900 && serd.value<=1200){ img.src="http://i9.tinypic.com/6z5re3m.jpg"; }
if (serd.value>1200 && serd.value<=1500){ img.src="http://i13.tinypic.com/80wu1vr.jpg"; }
if (serd.value>1500 && serd.value<=1800){ img.src="http://i13.tinypic.com/6yl8g9v.jpg"; }
if (serd.value>1800){ img.src="http://i19.tinypic.com/869ubvb.jpg"; }
}
if(j==2)
{
pouf=document.getElementById(3);
if (pouf.value<=300){ img.src="http://i14.tinypic.com/8esbcio.jpg"; }
if (pouf.value>300 && pouf.value<=600){ img.src="http://i3.tinypic.com/86heb7o.jpg"; }
if (pouf.value>600 && pouf.value<=900){ img.src="http://i15.tinypic.com/836vdir.jpg"; }
if (pouf.value>900 && pouf.value<=1200){ img.src="http://i12.tinypic.com/6xbuyhy.jpg"; }
if (pouf.value>1200 && pouf.value<=1500){ img.src="http://i13.tinypic.com/8211j51.jpg"; }
if (pouf.value>1500 && pouf.value<=1800){ img.src="http://i8.tinypic.com/7w7lcec.jpg"; }
if (pouf.value>1800){ img.src="http://i15.tinypic.com/870ppj7.jpg"; }
}
if(j==3)
{
serp=document.getElementById(4);
if (serp.value<=300){ img.src="http://i6.tinypic.com/6ltu7np.jpg"; }
if (serp.value>300 && serp.value<=600){ img.src="http://i5.tinypic.com/72741mf.jpg"; }
if (serp.value>600 && serp.value<=900){ img.src="http://i4.tinypic.com/6yd1qhs.jpg"; }
if (serp.value>900 && serp.value<=1200){ img.src="http://i3.tinypic.com/8719fth.jpg"; }
if (serp.value>1200 && serp.value<=1500){ img.src="http://i6.tinypic.com/85ay9hl.jpg"; }
if (serp.value>1500 && serp.value<=1800){ img.src="http://i12.tinypic.com/6s9iotu.jpg"; }
if (serp.value>1800){ img.src="http://i1.tinypic.com/86jy3cw.jpg"; }
}
td.appendChild(img);
tr.appendChild(td);

}
if(i==0)
{
td=document.createElement("TD");
p=document.createElement("P");
if(j==0){ td.className="gryffondor"; td.id=1; points=100; }
if(j==1){ td.className="serdaigle"; td.id=2; points=100; }
if(j==2){ td.className="poufsouffle"; td.id=3; points=100; }
if(j==3){ td.className="serpentard"; td.id=4; points=150; }

p.innerHTML=points;
td.value=points;
td.appendChild(p);
tr.appendChild(td);
}
}

table.appendChild(tr);
body.appendChild(table);
}

}

</script>
</head>
<body onload="sabliers();">

</body>
</html>
Configuration: Windows XP
Firefox 2.0.0.9
Répondre à magickirua  Signaler ce message aux modérateurs Aller au dernier message

1


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
sfel, le vendredi 23 novembre 2007 à 19:10:06
bonjour, avant tout, de quel version d'IE parles-tu ??? 5, 6 ou 7 ? ou les trois

et surtout sur la(les)quel(s) veux-tu faire fonctionner ton script ?? (ne considère pas IE 5, il es tun peu trop obsolète)

L'ennemi est bête : il croît que c'est nous l'ennemi, alors que c'est lui !
GLOUGLOU ...
Répondre à sfel

2


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
 magickirua, le vendredi 23 novembre 2007 à 19:29:00
eh bien, version 6 et 7 si possible. (Sachant que je déteste IE :P mais je le fais pour les usagers de mon site...)
Répondre à magickirua
Discussions pertinentes trouvées dans le forum
30/11 19h50Mon code javascript ne marche pas sous ie !!!3
22/05 11h43Code javascript pour mail3
29/04 14h24Pb code Javascript2
21/03 09h57Pb javascript IE65
Plus de discussions sur « Code javascript sous IE »
Logiciels pertinents trouvés dans les téléchargements
Télécharger SmitFraudFix 2.320SmitFraudFix - Cet utilitaire corrige les infections de type Desktop Hijack (détournement du bureau) : AdwarePunisher sur CCM , ...Catégorie: Anti-Spyware
Licence: Freeware/gratuit
Télécharger Vista Codec Package 4.7.2Vista Codec Package - Vista Codec Package regroupe une collection impressionnante de codecs (audio et vidéo), permettant d'ouvrir la plupart...Catégorie: Codecs
Licence: Freeware/gratuit
Télécharger DivX codecs 6.8.3DivX codecs - Le codec Divx Community est gratuit pour un usage personnel et permet de lire les fichiers au format DivX ! L'installeur...Catégorie: Codecs
Licence: Freeware/gratuit
Télécharger K-Lite Codec Pack Full 4.0.0K-Lite Codec Pack Full - K-Lite Codec Pack est une collection de codecs et de filtres nécessaires pour encoder ou décoder des formats audio ou vidéo....Catégorie: Codecs
Licence: Open Source
Plus de logiciels gratuits sur « Code javascript sous IE »