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

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: HTML DOM ʵÀý

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

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

HTML DOM
DOM TableRow ¶ÔÏ..
DOM Textarea ¶ÔÏ..
DOM Window ¶ÔÏó

HTML DOM ʵÀý


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

Anchor Object
Anchor ¶ÔÏó

Change text, URL, and target attribute of a link
¸Ä±äÎÄ×Ö£¬URLºÍÁ¬½Ó´ò¿ª·½Ê½ÊôÐÔ
Using focus() and blur()
ÓÃfocus()ºÍblur()µÃµ½ºÍʧȥ½¹µã
Add an accessKey to a link
¸øÁ¬½ÓÌí¼ÓÒ»¸ö¿ì½Ý¼ü

Document Object
Document ¶ÔÏó

Write text to the output
Êä³öÎÄ×Ö
Write text with formatting to the output
¸ñʽ»¯ÎÄ×ÖÊä³ö
Return the title of a document
·µ»ØÎĵµµÄ±êÌâ
Return the URL of a document
·µ»ØÎĵµµÄURLµØÖ·
Return the referrer of a document
ºÍÉÏÃæµÄ²î²»¶à£¬·µ»ØÎĵµ¼ÓÔØµÄµØÖ·
Return the domain name of the document's server
Îĵµ·þÎñÆ÷µÄÓòÃû
Use getElementById()
Õâ¸öºÜʵÓÃ...
Use getElementsByName()
Ô­ÀíºÍID²î²»¶à£¬µ«¿ÉÒÔ¶ÔÓ¦¶à¸öÔªËØ
Open a new document, specify MIME type and add some text
´ò¿ªÒ»¸öеÄÎĵµ£¬Ìí¼ÓһЩÎÄ×Ö
Return the number of anchors in a document
·µ»ØÎĵµÖÐÁ´½ÓµÄÊýÁ¿
Return the innerHTML of the first anchor in a document
·µ»ØÎĵµÀïµÚÒ»¸öÁ¬½ÓµÄÎÄ×ÖÄÚÈÝ
Count the number of forms in a document
¼ÆËãÎĵµÄÚµÄ±íµ¥ÊýÁ¿
Access an item in a collection
·ÃÎʼ¯ºÏÖеÄij¸öÏîÄ¿
Count the number of images in a document
¼ÆËãÎĵµÖÐͼƬÊýÁ¿

Event Object
ʼþ¶ÔÏó

Which mouse button was clicked?
ÄĸöÊó±ê°´Å¥±»µã»÷ÁË£¿
What are the coordinates of the cursor?
Êó±êµÄ×ø±êΪ¶àÉÙ£¿
What is the unicode of the key pressed?
°´¼üµÄunicodeֵΪ¶àÉÙ£¿
What are the coordinates of the cursor, relative to the screen?
Ïà¶ÔÓÚÆÁÄ»£¬Êó±êµÄ×ø±êÊǶàÉÙ£¿
What are the coordinates of the cursor?
Êó±ê×ø±ê
Was the shift key pressed?
ÊÇ·ñ°´ÁËshift°´Å¥
Which element was clicked?
ÄĸöÔªËØ±»µã»÷ÁË£¿
Which eventype occured?
·¢ÉúÁËʲôʼþÀàÐÍ£¿

Form and Form Input Objects
±íµ¥ÒÔ¼°±íµ¥ÄÚinput¶ÔÏó

View and change the action URL of a form
²é¿´²¢¸Ä±ä±íµ¥actionµÄURL
View the method that is to be used when sending form data
µ±´«µÝ±íµ¥Êý¾Ýʱ²é¿´´«µÝµÄmethodÀàÐÍ
Alert id, type, and value of a Button object + disable button
Ìáʾid,type,ÒÔ¼°°´Å¥µÄÖµ£¬²¢ÈÃÕâ¸ö°´Å¥ÎÞЧ
Check and uncheck a checkbox
Ñ¡ÖкͲ»Ñ¡Öи´Ñ¡¿ò
Checkboxes in a form
±íµ¥Öеĸ´Ñ¡¿ò
Checkbox - If the user clicks in a checkbox, the content of the text fields are converted to uppercase.
µ±Óû§Ñ¡Öи´Ñ¡¿ò£¬ÔòÎÄ×ÖÄÚÈÝת»»³É´óд×Öĸ
Radio buttons
µ¥Ñ¡°´Å¥
Reset a form
¸´Î»±íµ¥ÄÚÈÝ
Submit a form
Ìá½»±íµ¥
Form validation
±íµ¥Ð£Ñé
Set focus to an input field when the page loads
µ±Ò³Ãæ¼ÓÔØºó¾Û½¹µ½inputÇøÓò
Select the content of an input field
Ñ¡ÔñinputÇøÓòµÄÄÚÈÝ
Dropdown list in a form
ÔÚ±íµ¥ÖеÄÏÂÀ­Áбí
Another dropdown list
ÁíÍâÒ»ÖÖÐÎʽµÄÏÂÀ­Áбí
A dropdown menu
ÏÂÀ­²Ëµ¥
Jump to the next field when the current field's maxlength has been reached
µ±Ç®ÇøÓòÄÚÈÝ´ïµ½×î´óÏÞÖÆµÄʱºò×Ô¶¯Ìøµ½ÏÂÒ»¸öÇøÓò
Add accessKeys to form fields
Ϊ±íµ¥ÄÚÈݼÓÉÏaccessKeys

Frame, Frameset, ÒÔ¼° IFrame ¶ÔÏó

Resizable and not resizable frames
¿É±ä»¯¿ò¼Ü´óСºÍ²»¿É±ä»¯´óСµÄ¿ò¼Ü
Frames with and without scrollbars
´øÓÐ/²»´øÓйö¶¯ÌõµÄ¿ò¼Ü
Change the source / URL of two frames
¸Ä±äÁ½¿ò¼ÜµÄ Ô´ / url
Break out of a frame
ÍÑÀë¿ò¼Ü
Update two iframes
¸üÐÂÁ½¸öiframes

Image ¶ÔÏó

Change the height and width of an image
¸Ä±äͼƬµÄ¸ß¶ÈºÍ¿í¶È
Change the src of an image
¸Ä±äͼƬµÄÀ´Ô´

Location ¶ÔÏó

Send the client to a new location / URL
½«¿Í»§¶Ë´«ËͶ¼ÐµÄlocaton / URLÉÏ(×ªÒÆÎ»ÖÃ)
Reload a page
ÖØÐ¼ÓÔØÒ³Ãæ
Break out of a frame
ÍÑÀë¿ò¼Ü
Anchors array - This example opens two windows. The first window contains four buttons and the second window defines four anchors from 0 to 3. When a button is clicked in the first window, the onclick event handler goes to the specified anchor in the second window.
Õâ¸ö¾ÙÀý»á´ò¿ªÁ½¸ö´°¿Ú£¬µÚÒ»¸ö´°¿Ú°üº¬4¸ö¸ö°´Å¥£¬µÚ¶þ¸ö´°¿Ú¶¨ÒåÁË´Ó0µ½3£¬4¸öêµã¡£µ±µÚÒ»¸ö´°¿ÚµãÁ˰´Å¥£¬onclickʼþ¾Í»áÖ´ÐÐÒ»¸ö½«µÚ¶þ¸ö´°¿ÚµÄÏÔʾλÖÃÒÆ¶¯µ½Ö¸¶¨µÄêµãÉÏ¡£

Navigator ¶ÔÏó

Detect the visitor's browser and browser version
̽²â³ö·ÃÎÊÕßµÄä¯ÀÀÆ÷ÒÔ¼°ËüµÄ°æ±¾
More details about the visitor's browser
¸ü¶àÓйØä¯ÀÀÆ÷µÄÐÅÏ¢
All details about the visitor's browser
ËùÓÐÓйطÃÎÊÕßä¯ÀÀÆ÷µÄÐÅÏ¢
Alert user, depending on browser
¸ù¾Ýä¯ÀÀÆ÷À´¸øÓû§·¢³ö²»Í¬µÄÌáʾ

Option ºÍ Select ¶ÔÏó

Disable and enable a dropdown list
¿ÉÓúͲ»¿ÉÓõÄÏÂÀ­Áбí
Get the id of the form that contains the dropdown list
µÃµ½°üº¬ÏÂÀ­Áбí±íµ¥µÄid
Get the number of options in the dropdown list
»ñÈ¡ÏÂÀ­ÁбíÀï¿ÉÑ¡ÏîÄ¿µÄÊýÁ¿
Turn the dropdown list into a multiline list
½«ÏÂÀ­Áбí±äΪ¶àÐÐÏÔʾµÄ
Select multiple options in a dropdown list
ÈÃÏÂÀ­Áбí±äΪ¿ÉÒÔ¶àÑ¡
Alert the selected option in a dropdown list
ÌáʾÏÂÀ­ÁбíÖб»Ñ¡ÖеÄÏîÄ¿
Alert the index of the selected option in a dropdown list
ÌáʾÏÂÀ­ÁбíÖб»Ñ¡ÖÐÏîÄ¿µÄÐòºÅ
Change the text of the selected option
¸Ä±äÑ¡ÖÐÏîÄ¿µÄÎÄ×ÖÄÚÈÝ
Remove options from a dropdown list
½«¿ÉÑ¡ÏîÄ¿´ÓÏÂÀ­ÁбíÖÐÒÆ³ý

Screen ¶ÔÏó

Detect details about the client's screen
¼ì²â³ö¿Í»§¶ËËùʹÓÃµÄÆÁÄ»ÐÅÏ¢

Table, TableHeader, TableRow, TableData ¶ÔÏó

Change the width of a table border
¸Ä±ä±í¸ñ±ß¿òµÄ¿í¶È
Change the cellPadding and cellSpacing of a table
¸Ä±ä±í¸ñµÄcellPaddingºÍcellSpacing
Specify frames of a table
Ö¸¶¨±í¸ñµÄ¿ò¼Ü
Specify rules for a table
Ö¸¶¨±í¸ñµÄÏÔʾ¹æÔò
InnerHTML of a row
ÔÚÒ»ÐÐÖмÓÈëHTML´úÂë
InnerHTML of a cell
ÔÚ±í¸ñµ¥Ôª¸ñÖмÓÈëHTML´úÂë
Create a caption for a table
½¨Á¢±í¸ñµÄ±êÌâ
Delete rows in a table
ɾ³ý±í¸ñÐÐ
Add rows to a table
Ìí¼Ó±í¸ñÐÐ
Add cells to a table row
¼ÓÈë±í¸ñÐÐÖеĵ¥Ôª¸ñ
Align the cell content in a table row
¶ÔÆë±í¸ñÐÐÄÚÈݵÄ
Vertical align the cell content in a table row
´¹Ö±¶ÔÆë±í¸ñÐÐÖе¥Ôª¸ñÄÚÈÝ
Align the cell content in a single cell
¶ÔÆëµ¥¸öµ¥Ôª¸ñµÄÄÚÈÝ
Vertical align the cell content in a single cell
´¹Ö±¶ÔÆëijһµ¥Ôª¸ñµÄÄÚÈÝ
Change the content of a table cell
¸Ä±ä±í¸ñµ¥ÔªµÄÄÚÈÝ
Change the colspan of a table row
¸Ä±ä±í¸ñÐеĿç¶È

Window ¶ÔÏó

Display an alert box
ÏÔʾ¾¯Ê¾¿ò
Alert box with line-breaks
´ø»»Ðеľ¯Ê¾¿ò
Display a confirm box
ÏÔʾȷÈÏ¿ò
Display a prompt box
ÏÔʾÊäÈë¿ò
Open a new window when clicking on a button
°´Ï°´Å¥´ò¿ªÒ»¸öеĴ°¿Ú
Open a new window and control its appearance
¿ª´òÒ»¸öд°¿Ú²¢¿ØÖÆËüµÄÍâ¹Û
Open multiple windows with one click
ͨ¹ýÒ»´Îµã»÷´ò¿ª¹ý¸ö´°¿Ú
Send the client to a new location / URL
½«¿Í»§×ªË͵½ÐµĵØÖ·
Reload a page
ÖØÔØÒ³Ãæ
Write some text in the windows status bar
ÔÚ״̬ÌõÉÏдЩÎÄ×Ö
Print a page
´òÓ¡Ò³Ãæ
Break out of a frame
ÍÑÀë¿ò¼Ü
Resize a window
ÖØÉè´°¿Ú´óС
Resize a window to a specified size
½«´°¿ÚÖØÉèµ½Ö¸¶¨µÄ´óС
Scroll the window
¹ö¶¯´°¿Ú
Scroll the window to a specified position
½«´°¿Ú¹ö¶¯µ½Ö¸¶¨µÄλÖÃ
Simple timing
¼òµ¥µÄ¼ÆÊ±
Another simple timing
ÁíÒ»¸ö¼òµ¥µÄ¼ÆÊ±
Timing event in an infinite loop
ÎÞÏÞÑ­»·ÖеļÆÊ±Ê¼þ
Timing event in an infinite loop - with a Stop button
ÎÞÏÞÑ­»·ÖеļÆÊ±Ê¼þ - ´øÓÐÍ£Ö¹°´Å¥
A clock created with a timing event
¼ÆÊ±Ê¼þ½¨Á¢ÆðÀ´µÄʱÖÓ
½¨Á¢ÄÚÖô°¿Ú

ÆÀÂÛ (0) All