js var ImgObj=new Image();

API地址:

1
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement

 

下面来看看Image到底是个什么东东,我先将Image在W3C的标准地址贴出来

1
http://dev.w3.org/html5/spec-preview/the-img-element.html#dom-image

 

Three constructors are provided for creating HTMLImageElement objects (in addition to the factory methods from DOM Core such as createElement()): Image(), Image(width), and Image(width, height). When invoked as constructors, these must return a new HTMLImageElement object (a new img element).

 

标准里面说得很清楚,Image是用来创建HTMLImageElement对象的。

 

然后我们再来看一幅图

 

Image与HTMLImageElement 在toString()时,输出的内容都是一样的,但是Image与HTMLImageElement并不是同一个对象,所以我猜想Image是HTMLImageElement的一个封装类,用来构造HTMLImageElement的实例对象。

 

 

人家image是DOM对象啦。
至于你说的var TableObj=new Table()为啥没用?那是因为table是属于元素节点,NO 对象,创建使用document.createElement('table')

 

 

Image()构造函数创建一个新的HTMLImageElement实例。

它在功能上等同于document.createElement('img')

 

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image

 

posted @ 2018-01-22 19:39  ~雨落忧伤~  阅读(184)  评论(0编辑  收藏  举报