More Info


You are in: home > javascript > javascript api >

JavaScript API

Get Style Object - getStyleObject()

This function is lifted pretty much straight from Apple developer site (the copyright message allows it's use in other sites). This version will handle nested layers however.

The function returns the style object for the three types of browsers.

The Code

function getStyleObject(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		return getObjNN4(document,objectId);
	} else {
		return false;
	}
} 
<< PREVIOUS PAGE: Browser Sniffer NEXT PAGE: Change Object Visibility >>





 © James Austin 2002-05 Web site design by James Austin