PDA

View Full Version : onKeyUp not working



livegenesis
01-27-2011, 12:51 AM
Now, i am adding a onKeyUp function to change the radio if the value of another field is larger than 1. But this code isn't working... Any thoughts?



function getUses() {
var listcost = document.getElementsByName('form[listcost]');
var uses = document.getElementById('Uses');

if (uses == 1) {
listcost[0].checked = true;
}
else {
listcost[1].checked = true;
}
}

devnull69
01-27-2011, 08:23 AM
You're kidding me, aren't you?

Where do you get the "value" of the field "Uses" ?

Philip M
01-27-2011, 08:53 AM
if (uses.value == 1) {


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

livegenesis
01-27-2011, 09:12 AM
You're kidding me, aren't you?

Where do you get the "value" of the field "Uses" ?

I apologize. I understand that in order for me to get the value of an element I must put the .value after it. Otherwise, I only call the element itself, right? I am obviously very new at this and really appreciate the help. This can be a lesson to all newbies, remember the freakin' .value! :)

Anyways, thanks again! That did the trick.