Compatibilite NS6 IE5.5

Fermé
ZIG1 Messages postés 1709 Date d'inscription vendredi 7 juillet 2000 Statut Membre Dernière intervention 24 mars 2009 - 18 juil. 2001 à 11:19
Bobinours Messages postés 2898 Date d'inscription jeudi 26 avril 2001 Statut Membre Dernière intervention 21 mars 2013 - 19 juil. 2001 à 18:36
Bonjour,

Je suis entrain de creer un script afin de transfert des éléments d'une liste à l'autre.
Pour pouvoir les ordonner j'ai voulu creer une fonction d'insertion.
Ca marche mais seulement sous NS6 or je ne suis intéréssé que par IE 5.5.
Il parait qu'en ligne 21 caractere 4 l'objet ne gere pas cette propiete ou cette methode.

l'ennui c'est qu'a cet endroit preci, j'ai une tabulation

voici ma page :

<HTML>
<HEAD>
<TITLE>V 6 ...</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function Deplacer(l1,l2) {
if (l1.options.selectedIndex>=0) {
o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
l2.options[l2.options.length]=o;
l1.options[l1.options.selectedIndex]=null;
}else{
alert("Aucun article sélectionnée");
}
}
function Insertion(l1,l2){
if(l1.options.selectedIndex>=0 && l2.options.selectedIndex>=0) {
l1.options.length++;
for (var i=l1.options.length-1;i>l1.options.selectedIndex;i--) {
var p=Option(l1.options[i-1].text,l1.options[i-1].value);
l1.options[i]=p;
} /*ligne21*/
l1.options[l1.options.selectedIndex]=l2.options[l2.options.selectedIndex]; /*ligne22*/
} else {
alert("Insertion impossible. Sélectionnez un article dans chaque liste");
}
}
</SCRIPT>
</HEAD>

<BODY bgcolor="#FFFFFF">
<FORM name="formulaire">

<TABLE width="100%">
<TR>
<TD align="center" width="33%">
<DIV align="center"><FONT size="2"><B>Liste
ordonnée des articles de la Une</B></FONT><BR>
<SELECT align=top name="liste2" size=6 style="width:120px">
<OPTION value="10">----------------------</OPTION>
</SELECT>
</DIV>
</TD>
<TD align="center" width="33%">
<DIV align="center">
<INPUT type="button" value="<<< Ajouter" onClick="Deplacer(this.form.liste1,this.form.liste2)">
<BR>
<INPUT type="button" Value="<<< Insérer" onClick="Insertion(liste2,liste1)">
<BR>
<INPUT type="button" value="Enlever >>>" onClick="Deplacer(this.form.liste2,this.form.liste1)" name="button">
</DIV>
</TD>
<TD align="center" width="33%">
<DIV align="center"><B><FONT size="2">Aritcle
proposées</FONT></B><BR>
<SELECT align=top name="liste1" size=6 style="width:120px">
<OPTION value="article1">article1</OPTION>
<OPTION value="article2">article2</OPTION>
<OPTION value="article3">article3</OPTION>
<OPTION value="article4">article4</OPTION>
<OPTION value="article5">article5</OPTION>
<OPTION value="article6">article6</OPTION>
</SELECT>
</DIV>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


Si vous trouvez l'erreur !!

2 réponses

Bobinours Messages postés 2898 Date d'inscription jeudi 26 avril 2001 Statut Membre Dernière intervention 21 mars 2013 503
19 juil. 2001 à 00:08
Tout d'abord, ajoute "this.form." apres Insertion (pour la forme):
<INPUT type="button" Value="<<< Insérer" onClick="Insertion(this.form.liste2,this.form.liste1)">

Ensuite j'ai un peu magouillé pour que ça marche. J'ai remplacé la ligne:
* l1.options[l1.options.selectedIndex]=l2.options[l2.options.selectedIndex]; /*ligne22*/
par ces deux lignes:
* l1.options[l1.options.selectedIndex].text = l2.options[l2.options.selectedIndex].text;
* l1.options[l1.options.selectedIndex].value = l2.options[l2.options.selectedIndex].value;
C'est étrange que IE ne gère pas l'objet Option a part entière...

Ton script est trés interessant.

-= Bobinours =-
0
ZIG1 Messages postés 1709 Date d'inscription vendredi 7 juillet 2000 Statut Membre Dernière intervention 24 mars 2009 186
19 juil. 2001 à 09:39
Merci pour tes conseils.
Le but de ce script était de pouvoir ordonner les éléments de ma liste.
J'ai pris un autre script ducoup.

ICQ : 76860709

Merci pour ton aide et a bientôt j'espère
0
Bobinours Messages postés 2898 Date d'inscription jeudi 26 avril 2001 Statut Membre Dernière intervention 21 mars 2013 503
19 juil. 2001 à 18:36
Tu peux me montrer à quoi ressemble ce script ?

PS: Je n'ai pas ICQ ;)

-= Bobinours =-
0