document.classes.backgroundImage

JavaScript 1.2+ Nav4+ Syntax

document.classes.className.tagName.backgroundImage

Description

The backgroundImage property specifies the background image of an element as associated with the class called className. The definition can also specify a tag or the word all for tagName.

Example

Listing 7.62 makes the image logo.gif the background for the header text.

Listing 7.62 Setting the Background Image with the backgroundImage Property
<html>

<script>
<!-- Hide

//Create a style sheet class that uses an image as a background
document.classes.BGI.all.backgroundImage = "logo.gif";

//Hide End --->
</script>

<h2 class=BGI>Look at my background image!</h2>

</html>
							
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.