Properties of Image Objects
Property
|
Description
|
align
|
Indicates the alignment of the image, usually “left” or
“right.”
|
alt
|
The alternative text rendering for the image as set by the
alt attribute.
|
border
|
The width of the border around the image in
pixels.
|
complete
|
Non-standard (but well-supported) Boolean indicating whether
the image has completed loading.
|
height
|
The height of the image in pixels or as a percentage
value.
|
hspace
|
The horizontal space around the image in
pixels.
|
isMap
|
Boolean value indicating presence of the ismap attribute, which indicates the image is a server-side image
map. The useMap property is used more often
today.
|
longDesc
|
The value of the (X)HTML longdesc
attribute, which provides a more verbose description for the image than the alt attribute.
|
lowSrc
|
The URL of the “low source” image as set by the lowsrc attribute. Under early browsers, this is specified by the
lowsrc property.
|
name
|
The value of the name attribute for the
image.
|
src
|
The URL of the image.
|
useMap
|
The URL of the client-side image map if the <img> tag has a usemap
attribute.
|
vspace
|
The vertical space in pixels around the image.
|
width
|
The width of the image in pixels or as a percentage
value.
|
The traditional
Image object also supports
onabort,
onerror, and
onload
event handlers. The
onabort handler is invoked when the user
aborts the loading of the image, usually by clicking the browser’s Stop button.
The
onerror handler is fired when an error occurs during image
loading. The
onload handler is, of course, fired once the
image has loaded. Under modern browser implementations that support (X)HTML
properly, you will also find
onmouseover,
onmouseout,
onclick, and the rest of the core
events supported for
Image.
Related Posts:
JavaScript Dynamic Links and Menus
Many sites use JavaScript to create links to other website pages. Here is some examplecode with different link types that you may want to avoid:
<HTML><head><title>Link Examples ~ Things to stay away from&l… Read More
Function Call Spacing
Almost universally, the recommended style for function calls is to have no space between
the function name and the opening parenthesis, which is done to differentiate it
from a block statement. For example:
// Good
doSom… Read More
JavaScript Refresh Page
you refresh the page using document.location.reload(). You can add the true keyword to force the reloaded page to come from the server (instead of cache). Alternatively, you can use the false keyword to reload the page from … Read More
Remote JavaScript
The primary reason is that the round trip time required to submit a form and
then download the response is often inconvenient. The user experience is much
improved if, instead of clicking a Submit button and watching the … Read More
JavaScript Form Validation
JavaScript Form Validation. JavaScript can be used to validate data in HTML forms
<script type="text/javascript">
function validate_all()
{
var frmReg=document.manageadmin… Read More
Javascript Recursion
Recursion is when a function calls itself. This is often useful in mathematics,such as fi nding the nth number in the Fibonacci series (1, 2, 3, 5,8, 13, 21…).function fi bonacci(n) {if ( n < 2 ) {return 1;} else {return … Read More
Javascript Math object
The Math object holds a set of constants and methods
enabling more complex mathematical operations than the basic arithmetic
operators
var root = Math.sqrt(10);
Constants Provided by the Math Object
Property
… Read More
Javascript Objects as Arguments
You may want to write functions that take many arguments, some ofwhich are optional.function drawElement( color, border, width, height,left, top, zIndex) {// Make and display an element with these variables}drawElement("red"… Read More
Javascript search
search(regexp)The search() method is the same as indexOf() except that it takes aregular expression pattern instead of a substring. It also returns -1 if thepattern isn’t found."hello world".search(/[aeiou]/); // Find the fi… Read More
The try-catch Statement
JavaScript provides a try-catch statement that is capable of intercepting thrown errors
before they are handled by the browser. The code that might cause an error comes in
the try block and code that handles the error goes i… Read More
Javascript Image Objects
Properties of Image Objects
Property
Description
align
Indicates the alignment of the image, usually “left” or
“right.”
alt
The alternative text rendering for the image as set by the
alt attribu… Read More
Embedding Content for Plug-Ins
Although never officially a part of any HTML specification,
the <<embed>> tag is most often used to include
embedded objects for Netscape and Internet Explorer. A Macromedia Flash file
might be embedded as fo… Read More
JavaScript Object Literals
Object literals are a popular way to create new objects with a specific set of properties,
as opposed to explicitly creating a new instance of Object and then adding properties.
For example, this pattern is rarely used:
… Read More
Javascript The + Operator
The binary + operator adds numeric operands or concatenates string operands:
1 + 2 // => 3"hello" + " " + "there" // => "hello there""1" + "2" // => "12"
When the values of both operands are numbers, or are both str… Read More
JavaScript and XML
To demonstrate JavaScript, XML, and the DOM in action, let’s
use Internet Explorer 5.5 or better to load an XML document containing our
employee directory and see if we can manipulate it. First, to load in the
document w… Read More