PDA

Click to See Complete Forum and Search --> : Radio Buttons HTML - Easy Question


Skeen
Oct 3rd, 2000, 08:08 AM
Hi Y'all

I've never used radio buttons B4 (honest), but I'm using them on a page to select from various options. The problem I have is, all buttons can be selected simultaniously, and so could anyone tell me how to create an 'exclusive OR' situation - It dosn't cover this in my html book (In fact, the examples have the same problem as me.

Cheers 'n' Beers,

Skeen

Mark Sreeves
Oct 3rd, 2000, 10:22 AM
I only used them for the first time last week!

They all need to have the same name (like an array).


<B>Select Beverage...</B><BR>
<INPUT id=16 type=radio name=radio1>16 Coffee white…<BR>
<INPUT id=27 type=radio name=radio1>27 Chocolate<BR>
<INPUT id=31 type=radio name=radio1>31 Coffee white with sugar<BR>
<INPUT id=39 type=radio name=radio1>39 Black no sugar<BR>
<INPUT id=41 type=radio name=radio1>41 Coffee white stuff<BR>
<INPUT id=63 type=radio name=radio1>63 Frothy Chocolate<BR>
<INPUT id=67 type=radio name=radio1>67 Stagnant Water<BR>
<INPUT id=843 type=radio name=radio1>843 Pete's wimpy drink<BR>

Oct 3rd, 2000, 11:52 AM
Why do you use ID?

Maybe its something new in HTML 4, but when I learned HTML a year and a half ago, I was tought to do it this way..


<HTML>
<HEAD>
<TITLE>My Radio Button Example</TITLE>
</HEAD>
<BODY>
<FORM ACTION="MAILTO:me@myisp.com" METHOD="POST">
<INPUT TYPE="RADIO" NAME="Age" VALUE="13">13 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="14">14 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="15">15 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="16">16 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="17">17 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="18">18 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="19">19 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="20">20 <BR>
<INPUT TYPE="RADIO" NAME="Age" VALUE="21">21 <BR>
</FORM>
</BODY>
</HTML>


I use the VALUE Property thing instead of ID...
I am sure your way works fine.. but I always read books and tutorials that said to do it this way.

Skeen
Oct 3rd, 2000, 12:45 PM
I get it now - count and loop through the buttons - returning th value.

Nice1 - works a treat!

have a stella on me!

Skeen

Mark Sreeves
Oct 4th, 2000, 02:15 AM
denniswrenn
No reason in particular!

that piece of code was taken from something I wrote to amuse my colleagues. ID worked (on IE5)so I left it at that.


Our company has a web based system called "Kappa" so I knocked-up a parody if it for ordering coffee and called it Kuppa :)

Oct 4th, 2000, 10:08 AM
I am not absolutely sure, but I think that VALUE would be more compatible with older browsers only being able to read HTML3.... :rolleyes:

But I don't have any older browsers... so I can't test it :(