This is my first post. I am CSS Intern at Creative Core in San Francisco. Following an example on pg. 250-1 of the book “DHTML for the World Wide Web” uses CSS and JavaScript to toggle an image on and off. My html editor error messages tell me “document object undefined among other things. Please help me.
Example
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<style type=”css”>
#march-hare {position: relative;}
</style>
<script language=”JavaScript” type=”text/javascript”>
function toggleVis(currElem) {
dom = eval(docObj + ‘.’ + currElem + styleObj);
state = dom.visibility;
if (state == “visible” || state == “show”)
{dom.visibility = “hidden”;}
else {dom.visivility = “visible”;}
}
<!–
//–>
</script>
</head>
<body>
<form action=”” method=”get”>
<div id=”march-hare” style=”position: relative;
visibility: hidden; font: bold 18pt/18pt helvetica;”>
<img src=”march-hare-5.jpg” width=”403″ height=”322″ alt=”march-hare-5.jpg”>
Hi There!
</div>
<input type=”button” value=”toggle” onClick=”toggleVis(‘march-hare’)”>
</form>
</body>
</html>