power-box.de
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 06.12.2005, 15:01   #1
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg

Problem mit Radio-Buttons


Hey,

ich hab hier ein kleines Problem mit der auswertung von Radio-Buttons! Es geht eigentlich nur darum per Javascript zu prüfen ob einer der Buttons ausgewählt wurde, wenn nicht soll eine Meldung erscheinen, ansonst wird das Formular gesendet.
Hier mal der Quellcode:
HTML-Code:
<tr>
<td align="center">
	<input type="radio" name="produkt" id="produkt" value="domain" <?php if ($produkt == "domain") { echo "checked"; } ?>>
</td>
<td align="center">
	<input type="radio" name="produkt" id="produkt" value="start" <?php if ($produkt == "start") { echo "checked"; } ?>>
</td>
<td align="center">
	<input type="radio" name="produkt" id="produkt" value="business" <?php if ($produkt == "business") { echo "checked"; } ?>>
</td>
<td align="center">
	<input type="radio" name="produkt" id="produkt" value="unlimited" <?php if ($produkt == "unlimited") { echo "checked"; } ?>>
</td>
</tr>
javascript:
Code:
function checkTheBox()
{
	if (document.getElementById('produkt').value == "")
	{
		alert ('Bitte wählen Sie ein Produkt aus!');
		return false;
	}
	else
	{
		alert (document.getElementById('produkt').value);
		//document.forms[0].submit();
	}
}
Mein Problem ist das der Wert von document.getElementById('produkt').value immer "domain" ist, auch wenn nichts oder ein anderer Radiobutton ausgewählt ist!!

Könnt ihr mir bitte helfen!!

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.

Geändert von Flow09 (06.12.2005 um 15:17 Uhr).
Flow09 ist offline   Mit Zitat antworten


Alt 06.12.2005, 19:54   #2
TP-Moderator
 
Benutzerbild von Nightline
 
Registriert seit: Jan 2003
Ort: Wien
Nightline ist ein richtiges Arbeitstier - DANKENightline ist ein richtiges Arbeitstier - DANKENightline ist ein richtiges Arbeitstier - DANKENightline ist ein richtiges Arbeitstier - DANKENightline ist ein richtiges Arbeitstier - DANKE
Probiers mal anders:
PHP-Code:
function checkTheBox() {
var 
radio document.forms[0].produkt;
var 
check false;

for (
i in radio) {
if (
radio[i].checked) {
check true;
alert(radio[i].value);
document.forms[0].submit();
}
}
if (
check == false)
alert ('Bitte wählen Sie ein Produkt aus!');


__________________
+lg Nightline
-------------------------
Fotos von Reisen und Veranstaltungen: http://www.coeser.de/ontour
Fotoportfolio: http://www.coeser.de/showcase/
DeviantArt-Account: http://nightline.deviantart.com
Nightline ist offline   Mit Zitat antworten
Alt 07.12.2005, 13:10   #3
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Funktioniert!! Super, danke!

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
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > HTML Puristen > Javascript
Problem mit Radio-Buttons Problem mit Radio-Buttons
« Probleme mit focus() im Firefox | setVariable Funktion - im IE ja im FF nein »

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 22:14 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