Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

image

这篇翻译不完整。请帮忙从英语翻译这篇文章

Summary

用于图片显示的元素,与HTML中的img相似.使用 src可以指定图片的URL.

More information is available in the XUL tutorial.

Note: Prior to Gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth. The new behavior aligns more with the HTML <img> element and shrinks both the width and height down proportionally.

Attributes
onerror, onload, src, validate
Properties
accessibleType, src
Style classes
alert-icon, error-icon, message-icon, question-icon

Examples

Image:Firefoxlogo2.png
<image src='Firefoxlogo.png' width='135' height='130'/>

Attributes

onerror
Type: script code
This event is sent to an image element when an error occurs loading the image.
onload
Type: script code
This event handler will be called on the image element when the image has finished loading. This applies whether the image is applied via the src attribute or the list-style-image style property. If you change the image, the event will fire again when the new image loads. This event will not bubble up the element tree.

 

src
Type: URI
The URI of the content to appear in the element.
validate
Type: one of the values below
This attribute indicates whether to load the image from the cache or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted, or leave out the attribute entirely for default handling:
  • always: The image is always checked to see whether it should be reloaded.
  • never: The image will be loaded from the cache if possible.

Properties

accessibleType
Type: integer
A value indicating the type of accessibility object for the element.

src
Type: URL
Gets and sets the value of the src attribute.

Inherited Properties
align, attributes, allowEvents, baseURI, boxObject, builder, childElementCount, childNodes, children, className, clientHeight, clientLeft, clientTop, clientWidth, collapsed, contextMenu, controllers, database, datasources, dir, firstChild, firstElementChild, flex, height, hidden, id, lastChild, lastElementChild, left, localName, maxHeight, maxWidth, menu, minHeight, minWidth, namespaceURI, nextElementSibling, nextSibling, nodeName, nodeType, nodeValue, observes, ordinal, orient, ownerDocument, pack, parentNode, persist, prefix, previousElementSibling, previousSibling, ref, resource, scrollHeight, scrollLeft, scrollTop, scrollWidth, statusText, style, tagName,textContent, tooltip, tooltipText, top, width

Methods

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener(), appendChild(), dispatchEvent(), getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getElementsByTagName(), getElementsByTagNameNS(), hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isSupported(), normalize(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS()

Style classes

alert-icon
Class that adds an alert icon. This typically looks like an exclamation mark. This and the other icon classes may be used by image elements or other elements which can have an image.
error-icon
Class that adds an error icon. This will typically be a red "X" icon.
message-icon
Class that adds a message box icon.
question-icon
Class that adds a question icon, which usually looks like a question mark.

See also the image and icon attributes.

Interfaces

文档标签和贡献者

 此页面的贡献者: cubeXiao
 最后编辑者: cubeXiao,