w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Textarea ¶ÔÏó
The Textarea object represents a text-area in an HTML form. For each instance of an HTML <textarea> tag in a form, a Textarea object is created.
Textarea¶ÔÏó´ú±íÁËHTML±íµ¥ÖеÄÎÄ×ÖÇøÓò¡£Ã¿µ±±íµ¥ÖгöÏÖ<textarea>±êÇ©¾ÍÒâζ׎¨Á¢ÁËTextarea¶ÔÏó
You can access a Textarea object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
Äã¿ÉÒÔʹÓÃË÷ÒýÔªËØÊý×éµÄË÷ÒýÊý»òÊÇÃû³ÆÀ´·ÃÎÊTextarea¶ÔÏó£¬Ò²¿ÉÒÔʹÓÃgetElementById()À´·ÃÎÊ
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
| Property ÊôÐÔ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| accessKey | Sets or returns the keyboard key to access the textarea ÉèÖûò·µ»Ø·ÃÎÊtextareaµÄ¿ì½Ý¼ü |
4 | Yes | ||
| cols | Sets or returns the width (in characters) of the textarea ÉèÖûò·µ»ØtextareaµÄ¿í¶È£¨ÓÃÿÐпÉÈÝÄɵÄÎÄ×ÖÊýÀ´×öÒÀ¾Ý£© |
3 | 1 | 6 | Yes |
| defaultValue | Sets or returns the initial contents of the textarea ÉèÖûò·µ»Øtextarea³õʼÄÚÈÝ |
3 | Yes | ||
| disabled | Sets or returns whether or not the textarea should be disabled ÉèÖûò·µ»ØtextareaµÄ״̬ |
5 | 1 | 6 | Yes |
| form | Returns a reference to the textarea's parent form ·µ»ØtextareaµÄ¸¸±í²Î¿¼ |
3 | 1 | 2 | Yes |
| id | Sets or returns the id of the textarea (In IE 4 this property is read-only) ÉèÖûò·µ»ØtextareaµÄidÖµ |
4 | 1 | No | |
| name | Sets or returns the name of the textarea ÉèÖûò·µ»ØtextareaµÄname |
3 | 1 | 2 | Yes |
| readOnly | Sets or returns whether or not the textarea should be read-only ÉèÖûò·µ»ØtextareaÊÇ·ñÓ¦¸ÃΪֻ¶Á |
4 | 1 | 6 | Yes |
| rows | Sets or returns the height (in rows) of the textarea ÉèÖûò·µ»ØtextareaµÄ¸ß¶È(¿ÉÓÉrowsÊôÐÔÖµÀ´×öµ÷Õû) |
3 | 1 | 6 | Yes |
| tabIndex | Sets or returns the tab order for the textarea ÉèÖûò·µ»ØtextareaµÄtab˳Ðò |
4 | Yes | ||
| type | Returns the type of the form element. For a textarea object it will always be "textarea" ·µ»Ø±íµ¥ÔªËØÀàÐÍ¡£textarea¶ÔÏó·µ»ØÎª"textarea" |
3 | 1 | 3 | Yes |
| value | Sets or returns the text in the textarea ÉèÖûò·µ»ØtextareaµÄÎÄ×Ö |
3 | 1 | 2 | Yes |
| Method ·½·¨ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| blur() | Removes focus from the textarea È¡ÏûtextareaµÄ½¹µã |
3 | 1 | 2 | Yes |
| click() | Simulates a mouse-click in the textarea Ä£·ÂÊó±êÔÚtextareaÀïµÄµã»÷ |
4 | No | ||
| focus() | Sets focus on the textarea ΪtextareaÉèÖý¹µã |
3 | 1 | 2 | Yes |
| select() | Selects and highlights the entire text that is in the textarea Ñ¡Öв¢ÓøßÁÁtextareaÀïÃæµÄÎÄ×Ö |
4 | 1 | 2 | Yes |
Óï·¨: object.event_name="someJavaScriptCode"
| Event ʼþ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| onBlur | Executes some code when the textarea loses focus µ±textareaʧȥ½¹µãµÄʱºòÖ´ÐдúÂë |
3 | 1 | 2 | |
| onChange | Executes some code when the textarea loses focus and its value has altered µ±textareaʧȥ½¹µãµÄʱºòÀïÃæµÄÄÚÈÝÓÖ·¢Éú±ä»¯ÔòÖ´ÐÐһЩ´úÂë |
3 | 1 | 2 | |
| onClick | Executes some code when the user clicks the left mouse button in the textarea µ±Êó±ê×ó¼üÔÚtextareaÀïµã»÷ºóÖ´ÐÐijЩ´úÂë |
4 | |||
| onFocus | Executes some code when the textarea gets focus µ±textareaµÃµ½½¹µãµÄʱºòÖ´ÐдúÂë |
3 | 1 | 2 | |
| onKeyDown | Executes some code when a key is pressed down in the textarea µ±ÔÚtextareaÀﰴס¼üµÄʱºòÖ´ÐÐijЩ´úÂë |
1 | 4 | ||
| onKeyPress | Executes some code when a key is pressed in the textarea µ±textareaÀï°´¹ý¼ü¾ÍÖ´ÐÐijЩ´úÂë |
1 | 4 | ||
| onKeyUp | Executes some code when a key is released in the textarea µ±ÔÚtextareaÀïÊͷŰ´¼üµÄʱºòÖ´ÐдúÂë |
1 | 4 | ||
| onSelect | Executes some code when some text in the textarea is selected µ±textareaÀïµÄijЩÎÄ×Ö±»Ñ¡ÖеÄʱºòÖ´ÐÐijЩ´úÂë |
1 | 2 |
ÆÀÂÛ (0)
All