| | |
limit no of char per line
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I do not know if there is a simple way. But at this moment here what you can do.
Write a event handler for onkeyup for your text area and count for every keypress if count exceeds 50 then append '\n'(new line character) by yourself.
thats it.
Your js keyhandler will look somthing like this:-
Write a event handler for onkeyup for your text area and count for every keypress if count exceeds 50 then append '\n'(new line character) by yourself.
thats it.
Your js keyhandler will look somthing like this:-
javascript Syntax (Toggle Plain Text)
var count = 0; function keypress (e) { if(count>=50) { document.getElementById('textarea_id').value = document.getElementById('textarea_id').value + '\n'; count = 0; } else { count++; } }
When you think you have done a lot, then be ready for YOUR downfall.
tried something like this
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript" type="text/javascript"> <!-- var count = 0; function ress(){ if(count>=5) { document.getElementById('textarea_id').value = document.getElementById('textarea_id').value + '\n'; count = 0; } else { count++; } } //--> </script> </head> <body> <form> <textarea name="textarea_id" onkeypress="ress();"></textarea> </form> </body> </html>
![]() |
Similar Threads
- Command Line Arguement, can't get it to read in an int (C)
- Code Malfunction? (C++)
- command line string swap (C)
- Replicating Screen textbox.text to defined printed area (VB.NET)
- Converting char into int (C++)
- Scanf vs fgets (C)
- VB6/Excel - Using Char(10) to fit a long rcrdset as two lines within same recordset (Visual Basic 4 / 5 / 6)
- first cannot conver std::string to const char, now runtime error! (C++)
- C program (not C++) in/out putting a entire sentence (C++)
- Signature Size Limit! (DaniWeb Community Feedback)
Other Threads in the JavaScript / DHTML / AJAX Forum
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox child close codes createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump maps masterpage math media microsoft mp4 object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n





