homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Getting a radiobutton checked in IE

 6:49 am on Apr 15, 2004 (gmt 0)

I have a script that selects a radio button according to certain preferences, like this:

function fillinprod(prev_value) {
for (i=0; i<document.form1.product.length; i++)
if (document.form1.product[i].value == prev_value )
document.form1.product[i].defaultChecked = true;
document.form1.product[0].defaultChecked = true;

What it does is that if a previous product is selected (taken from a PHP script), it'll fill in that, else it'll default to the first product in the list. It works in Moz, but not in IE.

Anyone know how to do it?



 11:46 am on Apr 15, 2004 (gmt 0)

I think you need to use .checked rather then .defaultChecked. I believe defaultChecked is readonly will you can read/write the checked property.


 11:59 am on Apr 15, 2004 (gmt 0)

Hmm... Nope, won't work.

[Edit]Doh, sorry. It does work, I just wrote Checked instead of checked. Damn case-sensitive thingamajingies... =P

Ah well. Thanks for the help! :)[/edit]

Rambo Tribble

 1:27 pm on Apr 15, 2004 (gmt 0)

I believe:


may be what you are looking for. Be aware your HTML tags must have values specified for the individual selections.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved