JavaScript problems
Posted: 2003-11-27 01:28am
I'm having some JavaScript problems. I have this code taken exactly as was written in the book that I'm using, but the File menu doesn't seem to want to work.. is there something I'm doing wrong or not seeing?
~ver
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Playing with pulldown menus</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--
stdBrowser = (document.getElementById) ? true : false
function toggleMenu(currElem,nextPos) {
menuObj = (stdBrowser) ? document.getElementById(currElem).style : eval("document." + currElem)
if (toggleMenu.arguments.length == 1) {
nextPos = (parseInt(menuObj.top) == -5) ? -90 : -5
}
menuObj.top = (stdBrowser) ? nextPos + "px" : nextPos
}
-->
</script>
<style type="text/css">
<!--
.menu {position:absolute; font:12px arial, helvetica, sans-serif; background-color:#CCCCCC; layer-background-color:#CCCCCC; top:-90px}
#fileMenu {left:10px; width:70px}
#searchMenu {left:85px; width:100px}
A {text-decoration:none; color:#000000}
A:hover {background-color:#000000; color:#FFFFFF}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<div id="fileMenu" class="menu" onMousover="toggleMenu('fileMenu',-5)" onMouseout="toggleMenu('fileMenu',-90)"><br>
<a href="javascript:window.open()">Open</a><br>
<a href="javascript:window.print()">Print</a><br>
<a href="javascript:history.back()">Back</a>
<a href="javascript:history.forward()">Forward</a><br>
<a href="javascript:window.close()">Close</a><hr>
<a href="javascript:toggleMenu('fileMenu')">File</a>
</div>
<div id="searchMenu" class="menu" onMouseover="toggleMenu('searchMenu',-5)" onMouseout="toggleMenu9'searchMenu',-90)"><br>
<a href="http://www.ask.com">Ask Jeeves</a><br>
<a href="http://www.google.com">Google</a><br>
<a href="http://www.alltheweb.com">All The Web</a><br>
<a href="http://www.av.com">AltaVista</a><br>
<a href="http://www.dmoz.com">Open Directory</a><hr>
<a href="javascript:toggleMenu('searchMenu')">Search</a>
</div>
</body>
</html>