dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: disable textbox, and enable it onselect options

  1. #1
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17

    disable textbox, and enable it onselect options

    hi
    i am fairly new to javascript
    i want to build code for
    a by default disabled textbox
    and a select option with some dropdown
    when i select any option from select then only the textbox should get enabled
    what shud i do for this?
    thanx

  2. #2
    Join Date
    Feb 2006
    Posts
    70
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="javascript">
    function entext()
    {
    alert(document.f1.selected.value);
    document.f1.t1.disabled=false;
    }

    </script>
    </head>

    <body>
    <form name="f1">
    <input type="text" name="t1" disabled>Textbox1<br>
    <select name="selected" onChange="entext()">
    <option value="In">India</option>

    <option value="Us">U.S.A</option>
    </select>
    </form>
    </body>
    </html>

  3. #3
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17

    thanx, it helped

    thanx
    i have made a little chanegs in the code, so that it can be run in php
    and it's working perfectly
    thanx a lot

  4. #4
    Join Date
    Apr 2012
    Posts
    1
    hai Gaurav,

    But your script is not worked in IE 8.0

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles