Welcome to WebmasterWorld Guest from 54.160.163.163

Forum Moderators: open

Message Too Old, No Replies

Getting a radiobutton checked in IE

How?

     

Wertigon

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

10+ Year Member



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;
break;
}
else
{
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?

HocusPocus

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

10+ Year Member



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

Wertigon

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

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



I believe:

document.form1.product[0].value

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month