ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Form ¶ÔÏó

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM
DOM ½éÉÜ
HTML DOM ¾ÙÀý
DOM ²Î¿¼
DOM ÕªÒª
HTML DOM ʵÀý
DOM Anchor
DOM Applet
DOM Area
DOM Base ¶ÔÏó
DOM Basefont¶ÔÏó
DOM Body ¶ÔÏó
DOM Document ¶ÔÏ..
DOM ʼþ
DOM Form ¶ÔÏó
DOM Frame ¶ÔÏó
DOM Frameset ¶ÔÏ..
DOM History
DOM Iframe ¶ÔÏó
DOM Image ¶ÔÏó
HTML DOM Button¶..

DOM Form ¶ÔÏó


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:9704 :: ::

Form Object
±íµ¥¶ÔÏó

The Form object represents an HTML form. For each instance of an HTML <form> tag in a document, a Form object is created.
±íµ¥¶ÔÏó´ú±íÒ»¸öHTML±íµ¥¡£HTMLÖÐÒ»ÓÐ<form>±êÇ©£¬Ò»¸ö±íµ¥¶ÔÏó¾Í±»½¨Á¢ÁË¡£

Forms are used to prompt users for input. The input data is normally posted to a server for processing.
±íµ¥±»ÓÃÀ´ÌáʾÓû§ÊäÈë¡£ÊäÈëµÄÊý¾ÝÒ»°ã±»·¢Ë͵½·þÎñÆ÷ÉÏ×ö´¦Àí

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Form Object Collections±íµ¥¶ÔÏ󼯺Ï

Collection
¼¯ºÏ
Description
ÃèÊö
IE  F N W3C
elements[] Returns an array containing each element in the form
·µ»Ø°üº¬±íµ¥ÖÐÿ¸öÔªËØµÄÊý×é
3 1 2 Yes

Form Object Properties±íµ¥¶ÔÏóÊôÐÔ

Property
ÊôÐÔ
Description
ÃèÊö
IE  F N W3C
acceptCharset Sets or returns a list of character encodings for form data that must be accepted by the server processing the form
ÉèÖûò»ñÈ¡´¦Àí±íµ¥µÄ·þÎñÆ÷±ØÐë½ÓÊܵÄÊäÈëÊý¾ÝËùÓõÄ×Ö·û±àÂ뷽ʽÁÐ±í¡£
3     Yes
action Sets or returns the URL of where the input data will be submitted
ÉèÖûò·µ»Ø½«±»Ìá½»µÄÊäÈëÊý¾ÝµÄURL
3 1 2 Yes
encoding Sets or returns the MIME encoding for the form 3 1 2 No
enctype Sets or returns the MIME encoding for the form
·µ»Ø»òÉèÖÃ±íµ¥µÄMIME±àÂë
5 1 6 Yes
id Sets or returns the id of the form (In IE 4 this property is read-only)
ÉèÖûò·µ»Ø±íµ¥µÄid
4 1   No
length Returns the number of elements in a form
·µ»Ø±íµ¥ÖÐÔªËØµÄÊýÁ¿
3 1 2 Yes
method Sets or returns how form data is submitted to the server ("get" or "post")
ÉèÖûò·µ»ØÊý¾ÝÌá½»¸ø·þÎñÆ÷µÄ·½Ê½("get"»ò "post")
3 1 2 Yes
name Sets or returns the name of a form
·µ»Ø»òÉèÖÃ±íµ¥µÄÃû³Æ
5     No
target Sets or returns the target window or frame that responses are sent to after submission of a form
ÉèÖûò»ñȡĿ±êÄÚÈÝÒªÏÔʾÓÚÄĸö´°¿Ú»ò¿ò¼Ü¡£
3 1 2 Yes

Form Object Methods±íµ¥¶ÔÏó·½·¨

Method Description IE F N W3C
reset() Resets the default values of all elements in the form (same as clicking the Reset button)
ÖØÖÃËùÓÐ±íµ¥ÄÚÔªËØÎªÄ¬ÈÏÖµ
4 1 3 Yes
submit() Submits the form (same as clicking the Submit button)
Ìá½»±íµ¥
3 1 2 Yes

Form Object Events±íµ¥¶ÔÏóʼþ

Syntax: object.event_name="someJavaScriptCode"
Óï·¨: object.event_name="someJavaScriptCode"

Event
ʼþ
Description
ÃèÊö
IE F N W3C
onReset Executes some code when a Reset event occurs
µ±ÖØÖÃʼþ·¢Éú¾ÍÖ´ÐÐһЩ´úÂë
4 1 3  
onSubmit Executes some code when a Submit event occurs
µ±Ìύʼþ·¢Éú¾ÍÖ´ÐÐһЩ´úÂë
3 1 2  

ÆÀÂÛ (0) All