<HEAD> <SCRIPT LANGUAGE="JavaScript"> // D'autres scripts et des tutoriaux sur http://www.toutjavascript.com var liste=new CreerListe("Choisir une destination","_blank",2,"Français","Anglais",""); // CreerListe (titre, destination, nb boutons, bouton1, bouton2, bouton3) // destination vaut "" pour rester dans la meme frame, "nomframe" ou "_blank" pour une nouvelle fenetre liste.Add("Microsoft","http://www.microsoft.fr","http://www.microsoft.com"); liste.Add("Yahoo","http://www.yahoo.fr","http://www.yahoo.com"); liste.Add("AMD","http://www.amd.com/france","http://www.amd.com"); function CreerListe(titre,target,nbBouton,bouton1,bouton2,bouton3) { this.titre=titre; this.target=target; this.nbBouton=nbBouton; this.nb=0; var button=new Array(bouton1,bouton2,bouton3); this.bouton=button; this.Add=AddLigne; this.Print=PrintCombo; } function AddLigne(libelle,b1,b2,b3) { var t=new Array(b1,b2,b3); var Ligne=new Object; Ligne.libelle=libelle; Ligne.tab=t; this[this.nb]=Ligne; this.nb++; } function PrintCombo() { var Z="<SELECT name='acces' size=1> "; Z+="<OPTION value='-1'>"+this.titre+"</OPTION>"; for (var i=0;i<this.nb;i++) { Z+="<OPTION value="+i+">"+this[i].libelle+"</OPTION>"; } Z+="</SELECT>"; for (var i=0;i<this.nbBouton;i++) { Z+=" <INPUT Type='button' value='"+this.bouton[i]+"' onclick='GoAcces(this.form,"+i+")'> "; } document.write(Z); } function GoAcces(f,no) { var index=f.acces.selectedIndex-1; if (index>=0) { if (liste.target=="_blank") { window.open(liste[index].tab[no]); } if (liste.target=="") { window.location=liste[index].tab[no]; } if ((liste.target!="")&&(liste.target!="_blank")) { parent.frames[liste.target].location=liste[index].tab[no]; } } else { alert("Choisir une option."); f.acces.focus(); } } </SCRIPT> </HEAD> <Body> <FORM> |