Harry: Select-Menü mit Array

Beitrag lesen

Seas mal wieder,

so geht's, wenn auch (etwas) umständlicher:

------------------------------------------------
<html>
<head>
<script language="JavaScript">
var item = new Array();
item[0] = new Array()
item[0][0] = 'thema1';
item[0][1] = 'adress1.htm';
item[1] = new Array()
item[1][0] = 'thema2';
item[1][1] = 'adress2.htm';
item[2] = new Array()
item[2][0] = 'thema3';
item[2][1] = 'adress3.htm';
item[3] = new Array()
item[3][0] = 'thema4';
item[3][1] = 'adress4.htm';

function go(thema)
{document.location.href=thema;}

function writemenu()
{

document.write("<form name="form">");
document.write("<select name="link" onChange="go(this.form.link.options[this.form.link.options.selectedIndex].value)"");
for (i=0; i<item.length; i++)
{
document.write("<option value="" + item[i][1] + "">");
document.write(item[i][0]);
document.write("</option>");
}

document.write("</select>");
document.write("</form>");
}

</script>

</head>

<body bgcolor="#FFFFFF">

<script language="JavaScript">
writemenu();
</script>

</body>

</html>
-----------------------------------------------------------

cya,

Harry