w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Input Password ¶ÔÏó
The Password object represents a password field in an HTML form. For each instance of an HTML <input type="password"> tag on a form, a Password object is created.
µ±HTML±íµ¥Öк¬ÓÐ<input type="password">±êÇ©¾ÍÒâζ×ÅPassword¶ÔÏó½¨Á¢ÆðÀ´ÁË
You can access a Password object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
Äã¿ÉÒÔ¸ù¾Ý±íµ¥µÄÔªËØ×éË÷ÒýÊý»òÃû³ÆÀ´·ÃÎÊPassword¶ÔÏó£¬Ò²¿ÉÒÔʹÓÃgetElementById()À´·ÃÎÊ
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
| Property ÊôÐÔ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| accept | Sets or returns a list of content types, which the server processing this form will handle correctly ÉèÖûò·µ»ØÄÚÈÝÀàÐÍÁÐ±í£¬·þÎñÆ÷¿ÉÒÔ¸ü׼ȷµÄ´¦ÀíÕâ¸ö±íµ¥ |
- | Yes | ||
| accesskey | Sets or returns the keyboard key to access the password field ÉèÖûò·µ»Ø¿ÉÒÔ·ÃÎÊpassword fieldµÄ¼üÅ̰´¼ü¡£ |
4 | Yes | ||
| defaultValue | Sets or returns the initial value of the password field ÉèÖûò·µ»Øpassword fieldµÄ³õʼֵ |
3 | 1 | 2 | Yes |
| disabled | Sets or returns whether or not the password field should be disabled ÉèÖûò·µ»Øpassword fieldÊÇ·ñ¿ÉÓà |
5 | 1 | 6 | Yes |
| form | Returns a reference to the password field's parent form ·µ»Øpassword fieldµÄ¸¸±í²Î¿¼ |
3 | 1 | 2 | Yes |
| id | Sets or returns the id of the password field (In IE 4 this property is read-only) ÉèÖûò·µ»Øpassword fieldµÄid |
4 | 1 | No | |
| maxLength | Sets or returns the maximum number of characters the user can enter in the password field ÉèÖú󷵻Øpassword fieldÀï¿ÉÊäÈëµÄ×î´óÏÞ¶È×Ö·ûÊý |
4 | 1 | 6 | Yes |
| name | Sets or returns the name of the password field ÉèÖûò·µ»Øpassword fieldµÄname |
3 | 1 | 2 | Yes |
| readOnly | Sets or returns whether the content of the password field is read-only ÉèÖûò·µ»Øpassword fieldÀïµÄÄÚÈÝΪֻ¶Á |
4 | 1 | 6 | Yes |
| size | Sets or returns the size of the password field ÉèÖûò·µ»Øpassword fieldµÄ´óС |
3 | 1 | 6 | Yes |
| tabIndex | Sets or returns the index that defines the tab order for the password field ÉèÖûò·µ»Øpassword fieldµÄtab˳Ðò |
4 | Yes | ||
| type | The type of the form element. For a password object it will always be "password" ±íµ¥ÔªËØÀàÐÍ¡£password ¶ÔÏó¾ÍÏÔʾΪ"password" |
3 | 1 | 3 | Yes |
| value | Sets or returns the value of the value attribute of the password field ÉèÖûò·µ»Øpassword fieldµÄvalueÊôÐÔÖµ |
3 | 1 | 2 | Yes |
| Method ·½·¨ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| blur() | Removes focus from the password field È¡Ïû¶Ôpassword fieldµÄ¾Û½¹ |
4 | 1 | 2 | Yes |
| click() | Simulates a mouse-click on the password field Ä£ÄâÊó±êµã»÷password field |
4 | 1 | No | |
| focus() | Sets focus on the password field ÈÃpassword field»ñµÃ¾Û½¹ |
3 | 1 | 2 | Yes |
| select() | Selects and highlights the entire text that is in the password field Ñ¡ÖÐpassword fieldÀïµÄÎÄ×Ö²¢ÇÒÏÔʾ¸ßÁÁ |
4 | 1 | 2 | Yes |
Syntax: object.event_name="someJavaScriptCode"
Óï·¨£º¶ÔÏó.ʼþÃû³Æ="һЩJS´úÂë"
| Event ʼþ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| onBlur | Executes some code when the password field loses focus µ±password fieldʧȥ¾Û½¹µÄʱºòÖ´ÐдúÂë |
4 | 1 | 2 | |
| onClick | Executes some code when the user clicks in the password field µ±Óû§µã»÷password fieldµÄʱºòÖ´ÐдúÂë |
4 | |||
| onFocus | Executes some code when the password field gets focus µ±password fieldµÃµ½¾Û½¹µÄʱºòÖ´ÐÐһЩ´úÂë |
3 | 1 | 2 | |
| onKeyDown | Executes some code when a key is pressed down in the password field µ±ÔÚpassword fieldÖа´×¡Ä³¼üµÄʱºòÖ´ÐдúÂë |
4 | 1 | 4 | |
| onKeyPress | Executes some code when an alphanumeric key is pressed in the password field µ±ÔÚpassword fieldÖа´Ï²¢ÊÍ·Åij¼üµÄʱºòÖ´ÐÐһЩ´úÂë |
4 | 1 | 4 | |
| onKeyUp | Executes some code when a key is released in the password field µ±ÔÚpassword fieldÖÐÊÍ·Åij¼üµÄʱºòÖ´ÐÐһЩ´úÂë |
4 | 1 | 4 | |
| onSelectStart | Executes some code when some text in the password field is selected µ±password fieldÖеÄÎÄ×ÖÑ¡ÖÐʱִÐÐһЩ´úÂë |
4 |