Thread: js: radio button value oproepen
-
01-05-2005, 16:06 #1
js: radio button value oproepen
Hallo mensen,
Kheb duz een formuliertje ontworpen waar de ingevulde gegevens via een alert scherm moeten weergegeven worden. Dit lukt mij niet bij de radio buttens er komt undifind op.
http://s40.yousendit.com/d.aspx?id=0...G07ZN7RGZ3Y6V3
Hoe moet dit?
Ik d8 zo "document.forms.joeri.geslacht.value " maar dit schijnt niet te werken.
Mvg F00RAAPIntel P4 3.0 | Abit IS7 | 4 x 256 DRR 400 | XFX 6600GT | IDE 120GB
PM 1.5 | 2 x 256 DRR | ATI Mobility 9700 | 60 GBQ-Dance Presents QLIMAX!no votes
-
-
01-05-2005, 18:15 #2Member
- Registered
- 11/07/02
- Location
- downtown Brugge
- Posts
- 575
- iTrader
- 0
- Mentioned
- 0 Post(s)
- Reputation
- 0/0
that should do it ..PHP Code:function toon()
{
var naam,leeftijd,geslacht
if (document.forms.joeri.geslacht[0].checked)
{
geslacht = "m"
}
else
{
geslacht = "v"
}
naam = document.forms.joeri.naam.value
leeftijd = document.forms.joeri.leeftijd.value
window.alert("Naam : " + naam + "\n" + "Leeftijd : " + leeftijd + "\n" + "Geslacht : " + geslacht);
}
maak best ook nog init functie die je geslacht standaard op M zet, anders als ze submitten zonder dat ze iets gechecked hebben, zal je weer undefined uitkomen ..
bv.
PHP Code:function init()
{
document.forms.joeri.geslacht[0].checked = true
}
" You take the blue pill and you wake up in your bed and believe whatever you want to believe. You take the red pill, you stay in wonderland and see how deep the rabbit hole goes. "no votes
-
01-05-2005, 19:47 #3
Thxn maat, dat werkte vlotjes , maar nu heb ik 3 radio buttons.
Hoe doe ik dat nu met die ifjes.
if (document.forms.joeri.geslacht[0].checked)
{
geslacht = "m"
}
else
{
geslacht = "v"
}
else
{
geslacht="onbepaald"
}
Dit lukt niet.Intel P4 3.0 | Abit IS7 | 4 x 256 DRR 400 | XFX 6600GT | IDE 120GB
PM 1.5 | 2 x 256 DRR | ATI Mobility 9700 | 60 GBQ-Dance Presents QLIMAX!no votes
-
01-05-2005, 22:46 #4
niemand die weet, hoe je met javascript een if else else maakt?
MVG F00RAAPIntel P4 3.0 | Abit IS7 | 4 x 256 DRR 400 | XFX 6600GT | IDE 120GB
PM 1.5 | 2 x 256 DRR | ATI Mobility 9700 | 60 GBQ-Dance Presents QLIMAX!no votes
-
01-05-2005, 23:57 #5Member
- Registered
- 08/06/03
- Location
- Affligem
- Posts
- 1,313
- iTrader
- 1 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/0
no votes
-
02-05-2005, 00:56 #6Member
- Registered
- 23/09/04
- Location
- 2000
- Posts
- 5,759
- iTrader
- 2 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 17/23
http://www.google.be/search?hl=nl&q=...e+zoeken&meta=
offtopic: uwen avatar lijkt op Gene Simmons van Kiss, alsek ni rechtstreeks naar uw avatar kijk..."Hookers and drunks instinctively understand that common sense is the enemy of romance." - Sebastian Horsleyno votes
-
02-05-2005, 18:09 #7
Nu wille mijn checkboxe nie werken... , kheb het toch juist staan met ne.value of gaat dat niet bij checkboxen? Tis sport waar ge bij moet zien.
MVG F00RAAP
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <script type="text/javascript"> function toon() { var naam,leeftijd,geslacht,dropdown,niveau,sport if (document.forms.joeri.geslacht[0].checked) { geslacht = "m" } else { geslacht = "v" } if (document.forms.joeri.niveau[0].checked){ niveau = "Beginnend" }else{ if (document.forms.joeri.niveau[1].checked){ niveau="Middelmatig" }else{ niveau="Gevorderd" } } naam = document.forms.joeri.naam.value leeftijd = document.forms.joeri.leeftijd.value dropdown=document.forms.joeri.Select1.value sport=document.forms.joeri.seclteren.value window.alert("Naam : " + naam + "\n" + "Leeftijd : " + leeftijd + "\n" + "Geslacht : " + geslacht + "\n" + "Verblijfplaats : " + dropdown + "\n" + "Niveau:" + niveau + "\n" + "Sport:" + sport ); } </script> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </head> <body> <form id="joeri" name="joeri"> <TABLE border="0"> <tr> <th> <b><i>Naam:</i></b><input id="naam" type="text" NAME="naam"> </th> <th> </th> <th> <b><i>Leeftijd</i></b><input id="leeftijd" type="text" NAME="leeftijd"> </th> </tr> <tr> <td> Geslacht </td> <td> Verblijfplaats </td> </tr> <tr> <td style="HEIGHT: 22px"> <input type="radio" name="geslacht" value="m" ID="Radio1">Man </td> <td style="HEIGHT: 22px"> <select size="1" name="dropdown" ID="Select1"> <option value="België" selected>België</option> <option value="Nederland">Nederland</option> <option value="Duitsland">Duitsland</option> <option value="Frankrijk">Frankrijk</option> </select> </td> </tr> <tr> <td><input type="radio" name="geslacht" value="v" ID="Radio2">Vrouw</td> </tr> <tr> <td></td> <td></td> <td><input type="submit" name="verstuur" value="Toon profiel" ID="Submit1" onclick="toon()"></td> </tr> <tr> <td>Sport</td> <td>Atletisch niveau</td> </tr> <tr> <td></td> <td></td> <td><input type="submit" name="verstuur" value="Nieuw profiel" ID="Submit2"> </td> </tr> <tr> <td> <input type="checkbox" name="seclteren" value="Lopen" ID="Checkbox1">Lopen<BR> <input type="checkbox" name="seclteren" value="Wandelen" ID="Checkbox2">Wandelen<BR> <input type="checkbox" name="seclteren" value="Fietsen" ID="Checkbox3">Fietsen<BR> <input type="checkbox" name="seclteren" value="Zwemmen" ID="Checkbox4">Zwemmen<BR> <input type="checkbox" name="seclteren" value="Skiën" ID="Checkbox5">Skiën<BR> <input type="checkbox" name="seclteren" value="Inline Skating" ID="Checkbox6">Inline Skating<BR> </td> <TD width="442"> <input type="radio" name="niveau" value="m" ID="Radio3">Beginnend<BR> <input type="radio" name="niveau" value="m" ID="Radio4">Middelmatig<BR> <input type="radio" name="niveau" value="m" ID="Radio5">Gevorderd<BR> </TD> <TD></TD> </tr> </TD></TABLE> </body> </form> </html>Intel P4 3.0 | Abit IS7 | 4 x 256 DRR 400 | XFX 6600GT | IDE 120GB
PM 1.5 | 2 x 256 DRR | ATI Mobility 9700 | 60 GBQ-Dance Presents QLIMAX!no votes
-
02-05-2005, 20:18 #8Member
- Registered
- 11/07/02
- Location
- downtown Brugge
- Posts
- 575
- iTrader
- 0
- Mentioned
- 0 Post(s)
- Reputation
- 0/0
http://users.pandora.be/wodka/check.htm
Beeld -> Bron
en kijk eh
jouw form staat gans onderaan code in comment ..
alle checkboxen hadden dezelfde naam .. best elk een eigen specifieke naam geven eh .. dan kan je da makkelijker aanspreken in javascript ..
ni dat mijn javascript de best mogelijke code is, maar het is een oplossing ..
en ik zie juist dat ik een fout laten staan heb,
je niveau's hebben allemaal dezelfde value ..
klopt toch ook ergens ni ?Last edited by WoDkA; 02-05-2005 at 20:20.
" You take the blue pill and you wake up in your bed and believe whatever you want to believe. You take the red pill, you stay in wonderland and see how deep the rabbit hole goes. "no votes
-
02-05-2005, 23:23 #9
Bedankt WoDkA, ik snap het eindelijk
Echt bedankt man
MVG F00RAAPIntel P4 3.0 | Abit IS7 | 4 x 256 DRR 400 | XFX 6600GT | IDE 120GB
PM 1.5 | 2 x 256 DRR | ATI Mobility 9700 | 60 GBQ-Dance Presents QLIMAX!no votes
