Object对象仅代表 HTML
句法:
- 它用于访问Object元素
document.getElementById("id");
- 它用于创建对象元素
document.createElement("object");
属性值:
Property | Description |
---|---|
align | It is used to set or return the alignment of the object |
archive | It is used to set or return a string which is useful in implementation of archive function |
border | It is used to set or returnsthe border around object |
code | It is used to set or return the src url of files of complied java classes. |
codeBase | It is used to set or return URL of components |
data | It is used to set or return the URL of the resource |
form | It is used to return parent form’s reference |
height | It is used to set or return object’s height |
hspace | Set or return horizontal margin |
name | Set or return object’s name |
standby | It is used to sets or return message while object loading |
type | It is used to sets or return the content type for data downloaded |
useMap | It is used to sets or returns the name of a image map of client-side |
vspace | Sets or return vertical margin |
width | It is used to sets or return width of object |
示例 1:访问对象元素并返回资源的 URL
Click the button to get
the URL of the embedded file.
输出:
- 在点击按钮之前:
- 点击按钮后:
示例 2:使用 document.createElement创建对象元素。
Click the button to create an
Object element with an embedded file.
输出:
- 在点击按钮之前:
- 点击按钮后:
支持的浏览器:
- 谷歌浏览器
- 火狐浏览器
- 边缘
- 苹果浏览器
- 歌剧