Re: About the DOM document object



On Mar 29, 3:49 pm, Lee <REM0VElbspamt...@xxxxxxx> wrote:
Drae...@xxxxxxxxx said:



In an if statement with "document.images" as it's expression, does it
simply check if there are any image elements in an HTML page? I'm
assuming if it finds any that the expression will return true and
execute the statements within the if.

if(document.images)
{
// various statements....
}

No, there don't have to be any images on the page for document.images
to evaluate to true. The browser simply has to support images (and in
some cases, images may have to be enabled).

--

You can call document.images.length and if it returns 0 then there are
no images, if it returns >= 1 then there are.

if (document.images.length > 0) {
//do image stuff
}
else {
//do no image stuff
}

.



Relevant Pages