Dynamisk dropdown
HejJeg sidder og pusler med en dobbelt dropdown. dvs den skal først vise den ene og derefter vise/lave den anden select.
Herefter skal den gå til den side man vælger:
men jeg kan ikke få det til at virke.
der vises kun TRE ( ? ) tomme dropdowns HJÆLP
<SELECT NAME="Menu1" onChange="changeListOfPages(this.form)">
<SCRIPT LANGUAGE="JavaScript">
with (document) {
tot = Menu1Options.length;
for (i = 0; i < tot; i++)
writeln("<OPTION>" +Menu1Options[i]);
}
</script>
</SELECT>
<SELECT NAME="Menu2" onChange="gotoPage(this.form)">
<script>
with (document) {
//writeln('<OPTION>""</option>');
for (i = 0; i < maxLength; i++)
writeln("<OPTION>" +Menu2Options[i]);
writeln("</SELECT>");
for (i = maxLength; i > Menu2OriginalLength; i--)
{ DoubleDropDownMenu.Menu2.options[i] = null; }
changeListOfPages();
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function changeListOfPages();
var maxLength = 25;
Menu2Options= new Array;
var Menu2OriginalLength = Menu2Options.length;
Menu1Options= new Array;
Menu1Options[0] = "Select a Region";
Menu1Options[1] = "Europe";
Menu1Options[2] = "Asia";
Menu1Options[3] = "Latin America";
Menu1Options[4] = "Middle East";
Menu1Options[5] = "Africa";
function changeListOfPages()
{
Menu2Options.length = 0;
Menu1SelectedItem = document.DoubleDropDownMenu.Menu1.selectedIndex;
if (Menu1SelectedItem == null) return;
if (Menu1SelectedItem == 0)
/*Personal Development*/
{
Menu2Options[0] = "";
if (Menu1SelectedItem == 1)
/*Europe . Menu*/
{
Menu2Options= new Array;
Menu2Options[0] = new Option("Select a country");
Menu2Options[1] = new Option(" Bosnia and Herzegovina ");
Menu2Options[2] = new Option(" Bulgaria ");
Menu2Options[3] = new Option(" Croatia ");
Menu2Options[4] = new Option(" Hungary ");
Menu2Options[5] = new Option(" Macedonia ");
Menu2Options[6] = new Option(" Romania ");
Menu2Options[7] = new Option(" Russia ");
Menu2Options[8] = new Option(" Ukraine ");
/*Europe-Pages*/
Pages = new Array;
Pages[0] = "";
Pages[1] = "../pages/BetalingsprofilBosniaHerzegovina.aspx ";
Pages[2] = "../pages/Betalingsprofilbulgaria.aspx ";
Pages[3] = "../pages/BetalingsprofilCroatia.aspx";
Pages[4] = "../pages/BetalingsprofilHungary.aspx";
Pages[5] = "../pages/BetalingsprofilMacedonia.aspx";
Pages[6] = "../pages/BetalingsprofilRomania.aspx";
Pages[7] = "../pages/BetalingsprofilRussia.aspx";
Pages[8] = "../pages/BetalingsprofilUkraine.aspx";
}
if (Menu1SelectedItem == 2)
/*Asia - Menu*/
{
Menu2Options= new Array;
Menu2Options[0] = new Option("Select a Country");
Menu2Options[1] = new Option(" China ");
Menu2Options[2] = new Option(" India ");
Menu2Options[3] = new Option(" Indonesia ");
Menu2Options[4] = new Option(" Japan ");
Menu2Options[5] = new Option(" Kazakhstan ");
Menu2Options[6] = new Option(" Malaysia ");
Menu2Options[7] = new Option(" Pakistan ");
Menu2Options[8] = new Option(" Philippines ");
Menu2Options[9] = new Option(" South Korea ");
Menu2Options[10] = new Option(" Taiwan ");
Menu2Options[11] = new Option(" Thailand ");
Menu2Options[12] = new Option(" Vietnam ");
/*Asia - pages*/
Pages = new Array;
Pages[0] = "";
Pages[1] = "../pages/BetalingsprofilChina.aspx ";
Pages[2] = "../pages/BetalingsprofilIndia.aspx ";
Pages[3] = "../pages/BetalingsprofilIndonesia.aspx";
Pages[4] = "../pages/BetalingsprofilJapan.aspx";
Pages[5] = "../pages/BetalingsprofilKazakhstan.aspx";
Pages[6] = "../pages/BetalingsprofilMalaysia.aspx";
Pages[7] = "../pages/BetalingsprofilPakistan.aspx";
Pages[8] = "../pages/BetalingsprofilPhilippines.aspx";
Pages[9] = "../pages/BetalingsprofilSouthKorea.aspx";
Pages[10] = "../pages/BetalingsprofilTaiwan.aspx";
Pages[11] = "../pages/BetalingsprofilThailand.aspx";
Pages[12] = "../pages/BetalingsprofilVietnam.aspx";
}
if (Menu1SelectedItem ==3)
/*Latin America - Menu*/
{
Menu2Options= new Array;
Menu2Options[0] = new Option("Select a Country");
Menu2Options[1] = new Option(" Argentina ");
Menu2Options[2] = new Option(" Brazil ");
Menu2Options[3] = new Option(" Chile ");
Menu2Options[4] = new Option(" Mexico ");
Menu2Options[5] = new Option(" Peru ");
/*Latin America - pages*/
Pages = new Array;
Pages[0] = "";
Pages[1] = "../pages/BetalingsprofilArgentina.aspx ";
Pages[2] = "../pages/BetalingsprofilBrazil.aspx ";
Pages[3] = "../pages/BetalingsprofilIndonesia.aspx";
Pages[4] = "../pages/BetalingsprofilChile.aspx";
Pages[5] = "../pages/BetalingsprofilMexico.aspx";
Pages[6] = "../pages/BetalingsprofilPeru.aspx";
}
if (Menu1SelectedItem ==4)
/*Middle East - Menu*/
{
Menu2Options= new Array;
Menu2Options[0] = new Option("Select a Country");
Menu2Options[1] = new Option(" Iran ");
Menu2Options[2] = new Option(" Israel ");
Menu2Options[3] = new Option(" Jordan ");
Menu2Options[4] = new Option(" Kuwait ");
Menu2Options[5] = new Option(" Lebanon ");
Menu2Options[6] = new Option("Saudi Arabia");
Menu2Options[7] = new Option(" Syria ");
Menu2Options[8] = new Option(" Turkey ");
Menu2Options[9] = new Option(" UAE ");
Menu2Options[10] = new Option(" Yemen ");
/*Middle East - pages*/
Pages = new Array;
Pages[0] = "";
Pages[1] = "../pages/BetalingsprofilIran.aspx ";
Pages[2] = "../pages/BetalingsprofilIsrael.aspx ";
Pages[3] = "../pages/BetalingsprofilJordan.aspx";
Pages[4] = "../pages/BetalingsprofilKuwait.aspx";
Pages[5] = "../pages/BetalingsprofilLebanon.aspx";
Pages[6] = "../pages/BetalingsprofilSaudiArabia.aspx";
Pages[7] = "../pages/BetalingsprofilSyria.aspx";
Pages[8] = "../pages/BetalingsprofilTurkey.aspx";
Pages[9] = "../pages/BetalingsprofilUAE.aspx";
Pages[10] = "../pages/BetalingsprofilYemen.aspx";
}
if (Menu1SelectedItem ==5)
/*Middle East - Menu*/
{
Menu2Options= new Array;
Menu2Options[0] = new Option("Select a Country");
Menu2Options[1] = new Option(" Algeria ");
Menu2Options[2] = new Option(" Egypt ");
Menu2Options[3] = new Option(" South Africa ");
/*Middle East - pages*/
Pages = new Array;
Pages[0] = "";
Pages[1] = "../pages/BetalingsprofilAlgeria.aspx ";
Pages[2] = "../pages/BetalingsprofilEgypt.aspx ";
Pages[3] = "../pages/BetalingsprofilSouthAfrica.aspx";
}
tot = Menu2Options.length;
for (i = Menu2OriginalLength; i > 0; i--)
{ document.DoubleDropDownMenu.Menu2.options[i] = null; }
{ document.DoubleDropDownMenu.Menu2.options[i] = Menu2Options[i]; }
document.DoubleDropDownMenu.Menu2.options[0].selected = true;
Menu2OriginalLength = Menu2Options.length;
/* This makes the value of Menu2OriginalLength correct, if the subjects have been changed. */
}
function gotoPage()
{
i = document.DoubleDropDownMenu.Menu2.selectedIndex;
window.location.href = Pages[i];
}
</script>