いくつかのフィールドを持つフォームを作成していますが、読みやすくするためにテーブルに配置されています。フォーム内にプルダウンメニューが必要ですが、「select / option」タグを使用すると、フォーム全体の前後に常にプルダウンが表示されます。どのようにできるのか?ここに例があります:
document.write('name "Addrow" <form action="xxxxxx.php?Mode=ADD" method="POST" enctype="multipart/form-data">')
document.write('<table width="900"><th width="250"></th><th width="650"></th>')
document.write('<TR>')
document.write('<TD>Codice evento:</td>')
document.write('<TD><input type="text" name="ID_evcls" maxlength="10" size="10"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TD>Tipo evento:</td>')
document.write('<TD><input type="text" name="ID_tipoev" maxlength="5" size="10"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TR>')
document.write('<TD>Titolo:</td>')
document.write('<TD><input type="text" name="TitEv" maxlength="35" size="35"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TR>')
document.write('<TD>Descrizione:</td>')
document.write('<TD><input type="text" name="Descr" maxlength="150" size="75"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TR>')
document.write('<TD>Data manifestazione:</td>')
document.write('<TD><input type="date" name="DataEv"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TR>')
document.write('<TD>Luogo manifestazione:</td>')
document.write('<TD><input type="text" name="PlacEv" maxlength="25" size="25"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TR>')
document.write('<TD>Nazione:</td>')
document.write('<TD><input type="text" name="NatEv" maxlength="3" size="3" value="ITA"></td>')
document.write('</TR>')
document.write('<TR>')
document.write('<TD>Immagine da utilizzare (JPEG):</td>')
document.write('<TD><input type="file" name="userfile"accept="image/jpeg"></td>')
document.write('</TR>')
document.write('</table>')
fn_buildchooseeventclass()
document.write('<input type="submit" value="Conferma inserimento">')
document.write('</form>')
}
function fn_buildchooseeventclass() {
document.write('<select name="carlist" form="Addrow">')
document.write('<option value="volvo">Volvo</option>')
document.write('<option value="saab">Saab</option>')
document.write('<option value="opel">Opel</option>')
document.write('<option value="audi">Audi</option>')
document.write('</select>')
}
</script>
</body>
</html>