I found this script a while back, but can't remember where. The getStyleObject method takes an id and returns the object and the changeDiv changes the div from display: none to display: block (or block to none). Just add these to your head and then add
- Code: Select all
changeDiv("Temp1", "block");
to your code.
- Code: Select all
//Returns an element in document with passed id (objectId)
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 {
return false;
}
}
//Changes the_div's display property to the_change (block or none)
function changeDiv(the_div,the_change)
{
var the_style = getStyleObject(the_div);
if (the_style != false)
{
the_style.display = the_change;
}
}
Post back if you have any questions.
-Mike