Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    onKeyUp not working

    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?


    Code:
    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;
    	}
    }

  2. #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    You're kidding me, aren't you?

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

  3. Users who have thanked devnull69 for this post:

    livegenesis (01-27-2011)

  4. #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    19,467
    Thanks
    217
    Thanked 2,700 Times in 2,676 Posts
    if (uses.value == 1) {


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

  5. Users who have thanked Philip M for this post:

    livegenesis (01-27-2011)

  6. #4
    New Coder
    Join Date
    Jan 2011
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    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.


 

Posting Permissions

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