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 3 of 3
  1. #1
    Regular Coder mOrloff's Avatar
    Join Date
    Nov 2008
    Location
    The Great Pacific NW, USA
    Posts
    422
    Thanks
    8
    Thanked 6 Times in 6 Posts

    Select Radio Button Onload (newbie)?

    I am trying to have a RB selected by default, and my skills are quite lacking.

    This is what I've come up with so far.
    I must be missing something 'cuz it aint workin'.
    Code:
    function setValue(){
    	document.partSrch.type[0].checked=true; 
    }
    body.onload = setValue();
    And a snippet of my form:
    Code:
    <form id="eduPartSearch" name="partSrch" method="post" action="">
    	PartNumber <input type="radio" name="type" value="pn" />
    	Description<input type="radio" name="type" value="desc" />
    Where am I going wrong?

    ~ Mo
    Last edited by mOrloff; 03-16-2009 at 10:25 PM.

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Does it need to be Javascript? Why not plain old html?
    Code:
    <input type="radio" name="something" id="something" value="someValue" checked="checked" /> Some Value
    Are you a Help Vampire?

  • #3
    Regular Coder mOrloff's Avatar
    Join Date
    Nov 2008
    Location
    The Great Pacific NW, USA
    Posts
    422
    Thanks
    8
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by tomws View Post
    ... Why not plain old html?
    Because I forgot about that .

    Thanks-a-bunch.


  •  

    Posting Permissions

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