HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 7th, 2000, 03:46 PM
HyperWhiz HyperWhiz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 4 HyperWhiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have a simple question that I can't seem to find an answer to any where else:

What do I need to do to find out which radio button is "checked," for the purpose of writing a cookie depending on which option is selected. I've tried to do it as I would a checkbox, but can't get it or any variations to work.

Any help would be most appreciated. Thank you!

HyperWhiz
aka Tyler

Reply With Quote
  #2  
Old October 8th, 2000, 04:00 PM
tvanbart tvanbart is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 35 tvanbart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
It'd be easier to help if you provide a code sample, but here goes:
First off, I checked the Javascript reference at http://developer.netscape.com and it appears that radio buttons have a "checked" property just like checkboxes do, but in an array, one per button.
A code example:

<script language="JavaScript">
<!--
function test() {
for (i=0; i<document.myForm.myRadio.length; i++) {
if (document.myForm.myRadio[i].checked) {
alert(document.myForm.myRadio[i].value);
}
}
}

// -->
</script>
</head>
<body>
<form name="myForm">
<input type="radio" name="myRadio" value="first"><br>
<input type="radio" name="myRadio" value="second">
<p>
<input type="button" value="test" onClick="test()">
</form>
</body>

Hope this helps, Ton



[This message has been edited by tvanbart (edited October 08, 2000).]

Reply With Quote
  #3  
Old October 8th, 2000, 09:11 PM
HyperWhiz HyperWhiz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 4 HyperWhiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, that answered my question perfectly. Thank you very much!

HyperWhiz
aka Tyler

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Simple radio button validation problem...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT