Pages

Monday, December 28, 2009

Display a HTML element using javascript - A cross browser solution

function hideElement(divId) {
var element;
// get the element referenced by the parameter elementID
if (typeof elementID === "string") {
element = document.getElementById(divId);
} else {
element = divId
}

if ((typeof element == 'undefined') || (element == null)) {
throw new Error(
'No element with id "' + divId + '" is found
- in function hideElement(divId)');
}
tabContent.style.display = 'none';
}

No comments:

Post a Comment