| | |
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 |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug calendar card checkbox child class column cookies createrange() css cursor dependent disablefirebug dom download dropdown editor element engine error events explorer ext file firehose flash form forms game google gwt html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n





