SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member slokey.com's Avatar
    Join Date
    Aug 2004
    Location
    Chicago
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing a hidden value with a checkbox

    I'm not 100% sure this is done in Javascript, but if it is, I need serious help. I'm looking to have month & day dropdowns active ONLY WHEN a check box is selected. The easiest way to do this would be much appreciated...Thanks!

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,499
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--
    function 
    lock(obj){
     
    obj=document.getElementById(obj);
     if (
    obj.getAttribute('disabled')){
      
    obj.removeAttribute('disabled');
     }
     else {
      
    obj.setAttribute('disabled','disabled');
     }
    }
    //-->
    </script></head>

    <body>
    <select id="fred" size="1" disabled="disabled" >
    <option>jan
    <option>feb
    <option>march
    </select>
    <input type="checkbox" checked=true name="" onclick="javascript:lock('fred');" >
    </body>

    </html> 

  3. #3
    SitePoint Member slokey.com's Avatar
    Join Date
    Aug 2004
    Location
    Chicago
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you soooooo much - awesome, simple code! Much appreciated!


Bookmarks

Posting Permissions

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