Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 JavaScript: Limit Text Area Characters Jump to:  
Category: >> JavaScript >> Limit Text Area Characters Bookmark and Share

<< lastnext >>

Snippet Name: Limit Text Area Characters

Description: Limit the number of characters that can be entered into a text area. Works with any number of text areas on the same page.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 27th, 2009

<script type="text/javascript">
	FUNCTION textCounter(textarea, counterID, maxLen) {
		cnt = document.getElementById(counterID);
		IF (textarea.value.length > maxLen){
			textarea.value = textarea.value.substring(0,maxLen);
		}
		cnt.innerHTML = maxLen - textarea.value.length;
	}
</script>
 
<textarea name="mytext" id="mytext" style="width:99%; height:100px;" value="" 
onkeyup="textCounter(this,'count_display',255);" 
onBlur="textCounter(this,'count_display',255);"
></textarea><br>
<span style="position: relative; left: 15;">
<table cellpadding="0" cellspacing="0" border="0" style="font-size:10px;"><tr><td>
Chars left:&nbsp;</td><td width="30" bgcolor="#ffffbb"><span id="count_display">255</span>
</td><td>&nbsp;(255 max)</td></tr></table>
</span>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 290 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?