•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,193 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,214 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 705 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jan 2008
Location: London, England
Posts: 57
Reputation:
Rep Power: 1
Solved Threads: 6
Hi, i have a form on my website, and I would like to have a text box next to another text box that displays how many letters the user can type into the box eg:
This is fine, but I would like the box with the numbers in it to count down as the user types in the first box, and if they delete something i would like the number to go back up again too.
If anyone could help me that'd be great thanks.
html Syntax (Toggle Plain Text)
<td><input type="text" name="description" maxlength="30" /></td> <td><input type="text" class="counter" value="30" disabled="true" /></td>
This is fine, but I would like the box with the numbers in it to count down as the user types in the first box, and if they delete something i would like the number to go back up again too.
If anyone could help me that'd be great thanks.
•
•
Join Date: Jan 2008
Location: Bangalore, India
Posts: 336
Reputation:
Rep Power: 0
Solved Threads: 32
use onkeydown event in text box,
in this event write a function which will take value of textbox check the length of string and then print the no. in the box......
in this event write a function which will take value of textbox check the length of string and then print the no. in the box......
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila.
~Mitch Ratcliffe
~Mitch Ratcliffe
Hi There,
Try This Code
javascript:
HTML:
Rahul Dev Katarey
Try This Code
javascript:
<script type="text/javascript">
function valueChange(){
textBox1 = document.getElementById('textBox1');
description = document.getElementById('description');
textBox1.value = description.value.length;
}
</script>HTML:
<input type="text" name="description" maxlength="30" id="description" onkeyup="valueChange()" /></td> <input type="text" class="counter" readonly="readonly" id="textBox1" />
Rahul Dev Katarey
Last edited by katarey : Feb 20th, 2008 at 1:16 pm.
Freelance Web Designer & Developer
Http//www.Katarey.com
Http//www.Katarey.com
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
cross-browser javascript menu with few lines of code firefox html javascript javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator prevent javascript menu from getting hidden under flash movies preventing the delay when src attribute of the images set via javascript
- CSS pseudo-letter ??? (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: I need HTML Dropdown Buttons to freeze Flash animation below it! urgent!please help!
- Next Thread: drop down menu going behind flash element please help


Linear Mode