LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] textareas (bah)

[Webdev] textareas (bah)

Lee Hosty hostyle at skynet.ie
Sun Nov 12 18:07:09 GMT 2000


just cause im bored ... here goes ... 

var myFixedValue = 25;

function checkLength() {
  if (document.theform.blah.value.length > myFixedValue) {
    document.theform.blah.value =
document.theform.blah.value.substring(0,myFixedValue);
  }
}

<form name="theform">
<textarea name="blah" onChange="oneliner()"></textarea>
</form>

of if youre a fan of oneliners in javascript :P

function oneliner() { document.theform.blah.value =
(document.theform.blah.value.length > myFixedValue) ?
document.theform.blah.value.substring(0,myFixedValue) :
document.theform.blah.value; }

im too lazy so i havent tested ir properly but it works here on  ... i
dunno which browsers support onChange ... onBlur would probably work just
as well ... and if its all broken then im really sorry to have wasted your
time but it should point you in the right direction ...

>Anyone got a nice simple script that does it without any horrible
>downcounting text boxes or anything?


   Lee Hosty -x- hostyle at skynet.ie -x- +353 (0)86 8768780





More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell