bonsoir,
je vx creer un editeur de menu avec javascript voilà ce que j'ai fait mais j'ai trouvé des dificultés au niveau de l'etape suivante plus précisamment dans la fonction record(k) .
si qlq à une solution je vous pris de me répondre le plus vite possible je suis encore débutante en javascript.
------------------------------------------------------------------------------------------------
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
nb = 0; nbs=0;
tab=new Array();
smn=new Array();
var k;
smn[1] = new Array;
smn[2] = new Array;
smn[3] = new Array;
smn[4] = new Array;
smn[5] = new Array;
smn[6] = new Array;
smn[7] = new Array;
//var a,b,c,d,e;
function suiv(){
//ch="";
id=window.open("","");
id.document.write('<head>');
id.document.write('<SCRIPT LANGUAGE="JavaScript">');
id.document.write('id=window.open("","");');
// id.document.write('for(var i=1;i<tab.length;i++){');
id.document.write(' function record(1) {if(id.document.getElementById("lien1").value != ""){nbs++;smn[nbs]=id.document.getElementById("lien1").value;alert("");id.document.getElementById("nb_lien1").innerHTML = nbs;id.document.getElementById("lien1").value = "";id.document.getElementById("lien1").focus();}}');
id.document.write('<\/script>');
id.document.write('</head>');
for(var i=1;i<tab.length;i++)
{
id.document.write('<tr><br><b>Enregistrement des liens du menu "<FONT COLOR=#cc0000>'+tab[i]+'</FONT>"</b>');
id.document.write('<br><br>Entrez ici le titre <input type="text" name="texte'+i+'" id="lien'+i+'" size="20" /><br><br><input type="button" value="Enregister ce lien" onclick="record('+i+')"> Nombre de liens enregistrés : <b><span id=nb_lien'+i+'>0</span></b><br></tr>');
/*toop=20;
ch+="<div id='menu"+i+"' style='align:center;width:100px;left:"+(i*100+50)+";background:#eeeeee;border:1px solid gray; ";
ch+="top:"+toop+"'>"+tab[i]+"</div>";*/
}
id.document.close();
}
function record1()
{
if(document.form3.titre.value != "")
{
nb++;
tab[nb]=document.form3.titre.value;
document.getElementById("nb_lien").innerHTML = nb;
document.form3.titre.value = "";
document.form3.titre.focus();
}
}
/*function raz()
{
document.location.href=document.location.href;
}
/*function Test(valeur)
{
document.ParaForm.couleur.value = valeur;
}
function palette() {
winImage = window.open("Couleur.html","_blank","width=400, height=185");
winImage.document.write("<body><center><TABLE border='0' cellpadding='0' cellspacing='0' bordercolor='#000000' ><TR>");
var h=new Array('00','33','66','99','CC','FF');
var col="";
for(var i=0;i<6;i++) {
for(var j=0;j<6;j++) {
for(var k=0;k<6;k++) {
col="#"+h[i]+h[j]+h[k];
winImage.document.write("<TD width='8' height='8' bgcolor='"+col+"'><a href='#' onClick=\"Test('"+col+"'); \">O</a></TD>");
}
}
winImage.document.write("</tr>");
}
winImage.document.write("</TABLE></center></body");
}
*/
//------------ fonction de l'affichege de menu---------------------------
</script>
</head>
<body>
<center><h1>Personnalisation de Menu</h1></center>
<table border="2" bordercolor="#3333FF" width="805" cellspacing="0"
align="center">
<tr>
<td>
<table width="805" cellspacing="0" align="center" >
<form enctype="text/plain" name="form0" method="post">
<tr>
<td align="left" height="50" colspan="8"><b><u><font size="4">Style Menu :</font></u></b>
</tr>
<tr>
<td align="right" height="50" width="400">Police du texte :
<td> <select name="police">
<option value="Verdana"> Verdana
</option><option value="Arial"> Arial
</option><option value="Courrier"> Courrier
</option></select>
</tr>
<tr>
<td align="right" height="50" width="400" >Attribus de police du texte :
<td><select name="attrib">
<option value="a"> Normal
</option><option value="b"> Gras
</option><option value="bi"> Gras et italique
</option><option value="i"> Italique
</option></select>
</tr>
<tr>
<td align="right" height="50" width="400">Taille du texte :
<td><select name="taille">
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>12</option></select>
</tr>
</form>
</table>
</tr>
<tr>
<td>
<table align="center" width="805" cellspacing="1" >
<form enctype="text/plain" method="post" name="form1">
<tr>
<td align="center" width="200" height="50"> La couleur du fond :
<td ><table width="450" align="left" border="1" bordercolor="#000000"
cellspacing="1"><tr>
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFFF33"></TD>
<TD width="30" bgcolor="#FFFF33" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFCC33"></TD>
<TD width="30" bgcolor="#FFCC33" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF9933"></TD>
<TD width="30" bgcolor="#FF9933" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF6633"></TD>
<TD width="30" bgcolor="#FF6633" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF3333"></TD>
<TD width="30" bgcolor="#FF3333" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#990033"></TD>
<TD width="30" bgcolor="#990033" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#0000FF"></TD>
<TD width="30" bgcolor="#0000FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFFFFF"></TD>
<TD width="30" bgcolor="#FFFFFF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#000000"></TD>
<TD width="30" bgcolor="#000000" height="20">
</TR>
<TR>
<TD width="05" height="20"><input type="radio" name="couleur"
value="#666633"></TD>
<TD width="30" bgcolor="#666633" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#66CC66"></TD>
<TD width="30" bgcolor="#66CC66" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#33FF66"></TD>
<TD width="30" bgcolor="#33FF66" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#3399CC"></TD>
<TD width="30" bgcolor="#3399CC" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#33CCFF"></TD>
<TD width="30" bgcolor="#33CCFF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#0066FF"></TD>
<TD width="30" bgcolor="#0066FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#9966FF"></TD>
<TD width="30" bgcolor="#9966FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#CC9933"></TD>
<TD width="30" bgcolor="#CC9933" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#CC9999"></TD>
<TD width="30" bgcolor="#CC9999" height="20">
</TR>
</TABLE>
</tr>
</form>
<form enctype="text/plain" method="post" name="form2">
<tr>
<td align="center" height="50"> La couleur du texte :
<td align="center" >
<table width="450" align="left" border="1" bordercolor="#000000"
cellspacing="1"><tr>
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFFF33"></TD>
<TD width="30" bgcolor="#FFFF33" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFCC33"></TD>
<TD width="30" bgcolor="#FFCC33" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF9933"></TD>
<TD width="30" bgcolor="#FF9933" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF6633"></TD>
<TD width="30" bgcolor="#FF6633" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FF3333"></TD>
<TD width="30" bgcolor="#FF3333" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#990033"></TD>
<TD width="30" bgcolor="#990033" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#0000FF"></TD>
<TD width="30" bgcolor="#0000FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#FFFFFF"></TD>
<TD width="30" bgcolor="#FFFFFF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#000000"></TD>
<TD width="30" bgcolor="#000000" height="20">
</TR>
<TR>
<TD width="05" height="20"><input type="radio" name="couleur"
value="#666633"></TD>
<TD width="30" bgcolor="#666633" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#66CC66"></TD>
<TD width="30" bgcolor="#66CC66" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#33FF66"></TD>
<TD width="30" bgcolor="#33FF66" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#3399CC"></TD>
<TD width="30" bgcolor="#3399CC" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#33CCFF"></TD>
<TD width="30" bgcolor="#33CCFF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#0066FF"></TD>
<TD width="30" bgcolor="#0066FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#9966FF"></TD>
<TD width="30" bgcolor="#9966FF" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#CC9933"></TD>
<TD width="30" bgcolor="#CC9933" height="20">
<TD width="05" height="20"><input type="radio" name="couleur"
value="#CC9999"></TD>
<TD width="30" bgcolor="#CC9999" height="20">
</TR>
</TABLE>
</tr>
</form>
</table>
</tr>
<tr>
<td>
<table align="center" width="805" cellspacing="0">
<form enctype="text/plain" method="post" name="form3">
<tr>
<td align="left" width="260" height="50"><b>Enregistrement des titres du menu :</b></tr><tr>
<td align="center" >Titre :<input type="text" name="titre" size="20"> Nombre de titres enregistrés :<b><span id=nb_lien>0</span></b></tr><tr>
<td align="right" > <input type="button" name="enregistrer"
value="Enregistrer" OnClick="record1()">
</tr>
</form>
</table>
</tr>
</tr>
</table><br><br>
<center><input type="button" name="suiv" value="Etape suivante >>" onclick="suiv()"></center>
</body>
</html>