Some print.
Some print.
~SingleForum~无废话记录~ + ~19~记录点有用的好吗?少说废话少装b~

~SingleForum~无废话记录~ » js

textarea增加maxlength

Started 2 years ago by admin. | Tags: . . .

JAVASCRIPT:
  1. < script language="javascript" type="text/javascript" >
  2. function DjCheckMaxlength(oInObj)
  3. {
  4. var iMaxLen = parseInt(oInObj.getAttribute('maxlength'));
  5. var iCurLen = oInObj.value.length;
  6.  
  7. if ( oInObj.getAttribute &#38;&#38; iCurLen > iMaxLen )
  8. {
  9. oInObj.value = oInObj.value.substring(0, iMaxLen);
  10. }
  11. } //@ END OF DjCheckMaxlength()
  12. < /script >
  13. # .....
  14. # < textarea maxlength="80" onkeyup="return DjCheckMaxlength(this);" >textarea >

RSS feed for this topic