Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » How to enabled or disabled input text using a checkbox


How to enabled or disabled input text using a checkbox

Reply
  #1 (permalink)  
Old 09-29-03, 02:26 AM
Han84 Han84 is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
How to enabled or disabled input text using a checkbox

Hi everyone,

I will like to know what the code for enable or disable a input text using a checkbox? For example, if i click on this check box,the input text will be enabled.
Thx alot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-13-03, 09:46 AM
jewellgr jewellgr is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Michigan USA
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Han84
Hi everyone,

I will like to know what the code for enable or disable a input text using a checkbox? For example, if i click on this check box,the input text will be enabled.
Thx alot
Here is some sample code that will enable the textbox when you click the checkbox.

<html>
<head>
<title>Untitled</title>
<script>
function enable()
{
document.myForm.textbox.disabled = false;
}
</script>
</head>
<body>
<form name="myForm">
<input type="checkbox" onclick="enable()">&nbsp;&nbsp;Enable<br><br>
<input type="text" name="textbox" value="Hello World" disabled>
</form>
</body>
</html>
-----------------------------------

To disable the text box again you can make a new function and just have disabled = true;
Hope this helps.
__________________
ArecaWeb Team
Gregg Kenneth Jewell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to validate mutiple rows using the same input text Han84 JavaScript 1 08-02-07 10:14 AM
displaying all duplicate records in my table. dsumpter PHP 6 09-02-03 11:54 AM


All times are GMT -5. The time now is 11:39 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.