HighDots Forums  

Auswahl beeinflusst weitere Menüauswahl + Werteübergabe

Javascript (German) Programmiersprache JavaScript. (de.comp.lang.javascript)


Discuss Auswahl beeinflusst weitere Menüauswahl + Werteübergabe in the Javascript (German) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Abend
 
Posts: n/a

Default Auswahl beeinflusst weitere Menüauswahl + Werteübergabe - 05-07-2007 , 09:42 AM






Hallo,

schreibe momentan an meiner Diplomarbeit an der Uni und muss für den
praktischen Teil eine Online-Auswertung vornehmen. Das Script wird
serverseitig ausgelesen. Dieser Abschnitt funktioniert. Beim JS sollen
nach der Auswahl des Geschlechtes weitere Dropdown-Menüs aktiviert und
diese Werte übergeben werden. An dieser Stelle hängt es (siehe
http://media.anthro.univie.ac.at/my_...its/indexa.php
"test/"4test"). Vielleicht kann mir jemand einen Tip geben, wie ich das
Script noch erweitern muss.
Besten Dank im Voraus!
Peter

function update_auswahl()
{
var sexAuswahl = document.forms.verzeichnis.sex;
var pilleAuswahl = document.forms.verzeichnis.pille;
var hormonAuswahl = document.forms.verzeichnis.hormon;
var pregnantAuswahl = document.forms.verzeichnis.pregnant;
var circleAuswahl = document.forms.verzeichnis.circle;
var cycleAuswahl = document.forms.verzeichnis.cycle;

pilleAuswahl.options.length = 0;
hormonAuswahl.options.length = 0;
pregnantAuswahl.options.length = 0;
circleAuswahl.options.length = 0;
cycleAuswahl.options.length = 0;

// DropDown Menue entleeren

if (sexAuswahl.options[sexAuswahl.selectedIndex].value == "0")

{ //####### BEGINN IF #########

pilleAuswahl.options[0] = new Option("--------");
hormonAuswahl.options[0] = new Option("--------");
pregnantAuswahl.options[0] = new Option("--------");
circleAuswahl.options[0] = new Option("---------");
cycleAuswahl.options[0] = new Option("------------------");
}
if (sexAuswahl.options[sexAuswahl.selectedIndex].value == "1")

{ pilleAuswahl.options[0] = new Option("--------");
hormonAuswahl.options[0] = new Option("--------");
pregnantAuswahl.options[0] = new Option("--------");
circleAuswahl.options[0] = new Option("---------");
cycleAuswahl.options[0] = new Option("------------------");


} //######### BEGINN ELSE IF ########

else if (sexAuswahl.options[sexAuswahl.selectedIndex].value == "2")

{ //######### BEGINN ELSE IF ########

pilleAuswahl.options[0] = new Option("[Auswahl]");
pilleAuswahl.options[1] = new Option("Nein");
pilleAuswahl.options[2] = new Option("Ja");

hormonAuswahl.options[0] = new Option("[Auswahl]");
hormonAuswahl.options[1] = new Option("Nein");
hormonAuswahl.options[2] = new Option("Ja");

pregnantAuswahl.options[0] = new Option("[Auswahl]");
pregnantAuswahl.options[1] = new Option("Nein");
pregnantAuswahl.options[2] = new Option("Ja");

circleAuswahl.options[0] = new Option("[Auswahl]");
circleAuswahl.options[21] = new Option("< 22 Tage");
circleAuswahl.options[22] = new Option("22 Tage");
circleAuswahl.options[23] = new Option("23 Tage");
circleAuswahl.options[24] = new Option("24 Tage");
circleAuswahl.options[25] = new Option("25 Tage");
circleAuswahl.options[26] = new Option("26 Tage");
circleAuswahl.options[27] = new Option("27 Tage");
circleAuswahl.options[28] = new Option("28 Tage");
circleAuswahl.options[29] = new Option("29 Tage");
circleAuswahl.options[30] = new Option("30 Tage");
circleAuswahl.options[31] = new Option("31 Tage");
circleAuswahl.options[32] = new Option("32 Tage");
circleAuswahl.options[33] = new Option("33 Tage");
circleAuswahl.options[34] = new Option("34 Tage");
circleAuswahl.options[35] = new Option("35 Tage");
circleAuswahl.options[36] = new Option("36 Tage");
circleAuswahl.options[37] = new Option("37 Tage");
circleAuswahl.options[38] = new Option("38 Tage");
circleAuswahl.options[39] = new Option("> 38 Tage");

cycleAuswahl.options[0] = new Option("[Auswahl]");
cycleAuswahl.options[1] = new Option("ist sehr regelmäßig");
cycleAuswahl.options[2] = new Option("schwankt etwa 1 Tag");
cycleAuswahl.options[3] = new Option("schwankt bis 1 Woche");
cycleAuswahl.options[4] = new Option("ist sehr unregelmäßig");

} //########### ENDE ELSE IF ###########
}

HTML:

<font size="+1" face="Verdana, Arial, Helvetica, sans-serif">
Ich nehme die Pille
</font>
<select name="pille" id="pille" size="1"
onchange="pilleAuswahl.options(this.value)">
<option selected value="0">
--------
</option>
</select>

<font size="+1" face="Verdana, Arial, Helvetica, sans-serif">
Nehme andere Hormonpr&auml;parate
</font>
<select name="hormon" id="hormon" size="1"
onchange="hormonAuswahl.options(this.value)">
<option selected value="0">
--------
</option>
</select>

<font size="+1" face="Verdana, Arial, Helvetica, sans-serif">
Ich bin schwanger
</font>
<select name="pregnant" id="pregnant" size="1"
onchange="pregnantAuswahl.options(this.value)">
<option selected value="0">
--------
</option>
</select>

<font size="+1" face="Verdana, Arial, Helvetica, sans-serif">
Mein monatlicher Zyklus dauert
</font>
</b>
<select name="circle" id="circle" size="1"
onchange="circleAuswahl.options(this.value)">
<option selected value="0">
---------
</option>
</select>

<font size="+1" face="Verdana, Arial, Helvetica, sans-serif">
Mein Zyklus
<select name="cycle" id="cycle" size="1"
onchange="cycleAuswahl.otions(this.value)">
<option selected value="0">
------------------
</option>
</select>

Reply With Quote
  #2  
Old   
horst lorenz
 
Posts: n/a

Default Re: Auswahl beeinflusst weitere Menüauswahl + Werteübergabe - 05-07-2007 , 11:21 AM






On 7 Mai, 15:42, Peter Abend <a0504... (AT) unet (DOT) univie.ac.at> wrote:

Hi Peter,
ich weiß nicht warum Du in dieser Newsgroup Fragen stellst, die
Antworten dann aber nicht liest.

Ich hatte Dich bereits auf 2 Fehler aufmerksam gemacht:

Quote:
var sexAuswahl = document.forms.verzeichnis.sex;
var sexAuswahl = document.verzeichnis.sex

Quote:
pilleAuswahl.options.length = 0;
Das funktioniert nicht, Du mußt in einer Schleife alle options auf
null setzen:
for ( z = 0; z < pilleAuswahl.options.length; z++ )
pilleAuswahl.option[z] = null;

Wenn Du das korrigiert hast, und es klappt immer noch nicht, dann
kannst Du Dich ja wieder melden... tschüß Horst.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.