HTML DOM 实例

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
访问集合中的某个项目
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
垂直对齐某一单元格的内容
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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值