Results 1 to 6 of 6

Thread: Radio Buttons HTML - Easy Question

  1. #1

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Smile

    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
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I only used them for the first time last week!

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

    Code:
    <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>
    Mark
    -------------------

  3. #3
    Guest
    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..

    Code:
    <HTML>
      <HEAD>
        <TITLE>My Radio Button Example</TITLE>
      </HEAD>
      <BODY>
        <FORM ACTION="MAILTO:[email protected]" 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.

  4. #4

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Wink Cheers

    I get it now - count and loop through the buttons - returning th value.

    Nice1 - works a treat!

    have a stella on me!

    Skeen
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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
    Mark
    -------------------

  6. #6
    Guest
    I am not absolutely sure, but I think that VALUE would be more compatible with older browsers only being able to read HTML3....

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width