/    Sign up×
Community /Pin to ProfileBookmark

pull down menu help

Hi all

I’m trying to implement a pull down menu and it’s not working. When I move the mouse over it, it just disappears. Can someone please help and suggest what’s wrong.

Thank you.

[CODE]<html>
<head>
<title>Untitled Document</title>

<script type=”text/javascript” language=”JavaScript”>

if (document.getElementById)
{
stdBrowser = true
}
else
{
stdBrowser = false
}

function toggleMenu(currElem, nextPos)
{
if (stdBrowser)
{
menuObj = document.getElementById(currElem).style
}
else
{
menuObj = eval(“document.” + currElem)
}

if (toggleMenu.arguments.length == 1)
{
if (parseInt(menuObj.top) == -5)
{
nextPos = -90
}
else
{
nextPos = -5
}
}

if (stdBrowser)
{
menuObj.top = nextPos + “px”
}
else
{
menuObj.top = 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:#000099;
color:#ffffff
}

</style>

</head>

<body bgcolor=”white”>

<div id=”fileMenu” class=”menu” onmouseover=”toggleMenu(‘fileMenu’, -5)” onmouseout=”toggleMenu(‘fileMenu’, -90)” ><br/>
<a href=”#”>Open</a>
<a href=”#”>Print</a>
<a href=”javascript:toggleMenu(‘fileMenu’)”>File</a>
</div>

<div id=”searchMenu” class=”menu” onMouseOver=”toggleMenu(‘searchMenu’, -5)” onMouseOut=”toggleMenu(‘searchMenu’, -90)”><br/>
<a href=”http://www.google.com”>google</a>
<a href=”http://www.ask.com”>ask</a>
<a href=”http://www.yahoo.com”>yahoo</a>
<a href=”javascript:toggleMenu(‘searchMenu’)”>Search</a>
</div>

</body>
</html>[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @beginner_83 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...