2 Dropdown mit Quickjump

proloser

Erfahrenes Mitglied
Hallo,

ich kenn mich mit Javascript nicht so gut aus und brauch es auch sehr selten und hab da ein kleines Script das nur mit einem Dropdown funktioniert und ich brauch zwei wie in dem folgendem Code aber der funktioniert nicht!


HTML:
<script language="JavaScript">
<!--
function QuickJump(Formular)
{
    var Element = Formular.Ziel.selectedIndex;
 
    if (Formular.Ziel.options[Element].value != 0) 
    {
        location = Formular.Ziel.options[Element].value;
    }   
}

function QuickJump2(Formular2)
{
    var Element = Formular2.Ziel.selectedIndex;
 
    if (Formular2.Ziel.options[Element].value != 0) 
    {
        location = Formular2.Ziel.options[Element].value;
    }   
}


//-->
</script>


<form name="Formular">
  <select name="Ziel" onchange="QuickJump(this.form);" multiple size="9">
    $category_01_list
  </select>
</form>

<form name="Formular2">
  <select name="D1" onchange="QuickJump2(this.form);" multiple size="9">
    $category_02_list
  </select>
</form>

MfG proloser
 
Hi,

ersetze mal in der Funktion QuickJump2 das Objekt Ziel durch D1.
Code:
function QuickJump2(Formular2)
{
    var Element = Formular2.D1.selectedIndex;
 
    if (Formular2.D1.options[Element].value != 0) 
    {
        location = Formular2.D1.options[Element].value;
    }   
}
Ciao
Quaese
 
Ich hab jetzt selber noch ein bisschen rumprobiert und es funktioniert auch so!

HTML:
<script language="JavaScript">
<!--
function QuickJump(Formular)
{
    var Element = Formular.Ziel.selectedIndex;
 
    if (Formular.Ziel.options[Element].value != 0) 
    {
        location = Formular.Ziel.options[Element].value;
    }   
}



//-->
</script>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="33%"><form name="Formular"><select name="Ziel" onchange="QuickJump(this.form);" multiple size="9">
      $category_01_list</select></form></td>
    <td width="33%"><form name="Formular"><select name="Ziel" onchange="QuickJump(this.form);" multiple size="9">
      $category_02_list</select></form></td>
    <td width="34%"><form name="Formular"><select name="Ziel" onchange="QuickJump(this.form);" multiple size="9">
      $category_03_list</select></form></td>
  </tr>
</table>


Trozdem Danke! ;)
 
Zurück