JavaScript Reference/Javascript Properties/maxLength

Материал из Web эксперт
Версия от 11:21, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"maxLength" Example

   <source lang="javascript">
   

<html> <body> <input type="password" id="myText"> <script language="JavaScript">

   document.getElementById("myText").maxLength = 10;

</script> </body> </html>


     </source>
   
  


"maxLength" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<input type="password"> <input type="text"> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"maxLength" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Sets the maximum number of characters that can fit into the text field.

Syntax:

document.getElementById("inputID").maxLength = value document.all.inputID.maxLength = value // IE only


     </source>