power-box.de
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 21.12.2005, 16:52   #1
TP-Senior
 
Benutzerbild von ZombyWoof
 
Registriert seit: May 2002
Ort: Saarbrücken
ZombyWoof macht alles soweit korrekt

Wert aus Radio-Button weiterverarbeiten


Hallo,

wenn ich bei Veränderung eines Dropdown-Menüs (also select) per onChange eine JS-Funktion aufrufe steht mir ja der gewählte Wert per document.formular.wert_aus_select.value; zur Verfügung. Kann mir jemand einen Tipp geben wie ich auf diese Art an den Wert eines ausgewählten Radio-Buttons drankomme?

Grüße Frank
ZombyWoof ist offline   Mit Zitat antworten


Alt 21.12.2005, 16:55   #2
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Vielleicht hilft dir das:

Code:
var radio = document.forms[0].radiobuttons;

	for (i in radio) 
	{
		if (radio[i].checked) 
		{
			alert(radio.value);
		}
	}
{
lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 21.12.2005, 16:57   #3
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Sorry, kleiner Fehler!!

Richtig: alert (radio[i].value);
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 21.12.2005, 20:10   #4
TP-Senior
 
Benutzerbild von ZombyWoof
 
Registriert seit: May 2002
Ort: Saarbrücken
ZombyWoof macht alles soweit korrekt
Huhu Flow,

... danke erstmal, ich werde das morgen mal probieren.
Als bekennender JS-Versager sei mir eine (wahrscheinliche dämliche) Frage erlaubt, woher kommt 'i' ?

Grüße Frank
ZombyWoof ist offline   Mit Zitat antworten
Alt 22.12.2005, 11:16   #5
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Aus:

for (i in radio)

diese Schleife läuft alle Elemente des Objects durch!!
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 22.12.2005, 15:59   #6
TP-Senior
 
Benutzerbild von ZombyWoof
 
Registriert seit: May 2002
Ort: Saarbrücken
ZombyWoof macht alles soweit korrekt
Hallo Flow,

merci wegen dem 'i', hab das gestern nicht mehr so ganz gepeilt :-)

ich habe jetzt mal folgendes versucht:


Code:
function checkhersteller() {
	  
 var radio = document.forms[0].art;

 for (i in radio)  {
		 if (radio[i].checked)  {
		                        	      alert (radio[i].value);
                                                                         }
	                                            }

 var IDhersteller       = document.rma.IDhersteller.value; // aus select
	 
}
checkhersteller(); wird also augerufen wenn in dem select-Ding etwas verändert wird, aber es passiert in dem Fall leider nix, also auch keine Alert-Box...?
Haste vielleicht noch einen Tipp? :-)

Grüße Frank
ZombyWoof ist offline   Mit Zitat antworten
Alt 22.12.2005, 16:05   #7
321
TP-Specialist
 
Benutzerbild von 321
 
Registriert seit: Nov 2004
Ort: Die Insel in Europa die aus Europa erst Europa macht _________________________ Nähe Lenzburg
321 hilft, wo's geht321 hilft, wo's geht321 hilft, wo's geht
Wie rufst Du checkhersteller() auf?
__________________
[321 Name="Joe"]
wie immer, lieber gleich mit notepad, dem Editor meines Vertrauens
[/321]


use my HTML-Tester

Motto'06: Mut zur deutschen Sprache!
321 ist offline   Mit Zitat antworten
Alt 22.12.2005, 16:06   #8
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Kann man sich irgendwo den ganzen Quelltext ansehen????

Edit:

Welchen Browser verwendest du? Wenn Du Firefox verwendest lad dir die WebDeveloper-Erweiterung runter, da gibts ne ganz nützliche Javascript-Konsole die dir die Fehler meldet bzw. im IE gibt es unten Links in der Statuszeile etwas ähnliches!!
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.

Geändert von Flow09 (22.12.2005 um 16:11 Uhr).
Flow09 ist offline   Mit Zitat antworten
Alt 22.12.2005, 16:28   #9
TP-Senior
 
Benutzerbild von ZombyWoof
 
Registriert seit: May 2002
Ort: Saarbrücken
ZombyWoof macht alles soweit korrekt
Hi Flow,

also eine Fehlermeldung gibt es keine ...
Hier mal eine leicht gekürzte Fassung von dem ganzen:

Code:
<form name="rma" method="post" action="<? echo"$PHP_SELF"; ?>">

<input type="radio" name="art" value="1" />
<input type="radio" name="art" value="2" />
<input type="radio" name="art" value="3" />

<select name="IDhersteller" onChange="return checkhersteller();">
	<option value="0">- Bitte ausw&auml;hlen -</option>
	<option value="1">eins</option>
    <option value="2">zwei</option>
    <option value="3">zwei</option>
</select>

</form>
in der (externen) JS-Datei dann bisher dies hier:

Code:
function checkhersteller() {  
var IDhersteller       = document.rma.IDhersteller.value; // aus select
 window.location.href='/index.php4?IDhersteller='+IDhersteller;
}
Mit dieser window.location-Sache soll nun also der Wert von dem zuvor ausgewählten Radio-Button mit übergeben werden ....

Grüße Frank
ZombyWoof ist offline   Mit Zitat antworten
Alt 23.12.2005, 08:14   #10
TP-Senior
 
Benutzerbild von ZombyWoof
 
Registriert seit: May 2002
Ort: Saarbrücken
ZombyWoof macht alles soweit korrekt
Huhu,

habs hinbekommen

Code:
function checkhersteller() {
	
                              for (var i=0;i<document.rma.length;i++) 
                              	if (document.rma.elements[i].checked==true) var rmaart = document.rma.elements[i].value // radio
                              var IDhersteller       = document.rma.IDhersteller.value; // aus select
                              window.location.href='/rma.php4?rmaart='+rmaart+'&IDhersteller='+IDhersteller;
	                          return true;
 }
Grüße Frank
ZombyWoof ist offline   Mit Zitat antworten
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > HTML Puristen > Javascript
Wert aus Radio-Button weiterverarbeiten Wert aus Radio-Button weiterverarbeiten
« Request-URI Too Large | [JS] Formular-Fragen »

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 06:59 Uhr.

Powered by: vBulletin Version 3.7 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. / Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Traum-Projekt.com | Suchen | Archiv | Impressum | Kontakt | | | Nach oben |



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67