myGully.com

myGully.com (https://mygully.com/index.php)
-   Entwicklung & Programmierung (https://mygully.com/forumdisplay.php?f=72)
-   -   dropdown liste (https://mygully.com/showthread.php?t=2694565)

cyberdemon3 02.09.12 17:48

dropdown liste
 
hallo ich brauche ein dropdownliste mit 3 auswahlfelden die zu einen bestimmten seite verlinken.
habe schon ein code im netz gefunden, aber nur mir einer auswahlmöglichkeit.

wie wird dieser coder erweitert das ich mehrere felder habe?

<FORM>
<SELECT NAME="liste1" SIZE="1">
<OPTION SELECTED VALUE="">-------- Links to visit --------
<OPTION VALUE="link1.html">My first link
<OPTION VALUE="link2.html">My second link
</SELECT>
<INPUT TYPE="button" VALUE="Go"
onClick="if (form.liste1.selectedIndex != 0)
location = form.liste1.options[form.liste1.selectedIndex].value;
else
alert('Please choose a menu item')">
</FORM>

soll ca dann so aussehn:

[Link nur für registrierte und freigeschaltete Mitglieder sichtbar. Jetzt registrieren...]

aber nicht als suche sondern als direktlink

Last Breath 02.09.12 18:36

Meinst du so?


<FORM>
<SELECT NAME="liste1" SIZE="1">
<OPTION SELECTED VALUE="">-------- Links to visit --------
<OPTION VALUE="link1.html">My first link
<OPTION VALUE="link2.html">My second link
</SELECT>
<SELECT NAME="liste2" SIZE="1">
<OPTION SELECTED VALUE="">-------- Links to visit --------
<OPTION VALUE="link1.html">My first link
<OPTION VALUE="link2.html">My second link
</SELECT>
<SELECT NAME="liste3" SIZE="1">
<OPTION SELECTED VALUE="">-------- Links to visit --------
<OPTION VALUE="link1.html">My first link
<OPTION VALUE="link2.html">My second link
</SELECT>
<INPUT TYPE="button" VALUE="Go"
onClick="if (form.liste1.selectedIndex != 0)
location = form.liste1.options[form.liste1.selectedIndex].value;
else
alert('Please choose a menu item')">
</FORM>

cyberdemon3 02.09.12 18:53

hm wenn ich auf go klicke wird nur die erste liste berücksichtigt

die list 2 und 3 werden ignoriert

Last Breath 02.09.12 22:51

Ja.
Da muss wohl noch etwas hinzugeschrieben werden:

onClick="if (form.liste1.selectedIndex != 0)
location = form.liste1.options[form.liste1.selectedIndex].value;
else
alert('Please choose a menu item')">

cyberdemon3 02.09.12 23:27

naja ganz so leicht wars doch nicht ^^
hier der code für 2 auswahlfenster
jetzt muss ich nurnoch 3 hinbekommen.


Code:

<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<OPTION SELECTED VALUE="">-------- text --------
<option>text</option>
<option>text</option>
<option>text</option>
</select>
<select name="stage2" size="1">
<OPTION SELECTED VALUE="">-------- text --------
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>

<s*****>
<!--

var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("text","link")
group[0][1]=new Option("text","link")
group[0][2]=new Option("text","link")

group[1][0]=new Option("text","link")
group[1][1]=new Option("text","link")

group[2][0]=new Option("text","link")
group[2][1]=new Option("text","link")
group[2][2]=new Option("text","link")
group[2][3]=new Option("text","link")

var temp=document.doublecombo.stage2

function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}

function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</s*****>

</form>



Alle Zeitangaben in WEZ +1. Es ist jetzt 17:08 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.