Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pull-down menu problem

Status
Not open for further replies.

occas

Technical User
Jan 14, 2004
164
US
i have taken this code directly from a text i have. in fact, i have seen the code on the web in one of my searches. i get the menu to appear, but not a pull-down. it also loads with an "error on page", object expected, line 30, column 1. any help appreciated. ty.
<code>
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<html xmlns=&quot;<head>
<title>Menu</title>
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--


stdBrowser = (document.getElementById) ? true : false
function toggleMenu(currElem,nextPos) {
menuObj= (stdBrowser) ? document.getElementById(currElem).style : eval(&quot;document.&quot; + currElem)
if (toggleMenu.arguments.length == 1 {
nextPos = (parseInt(menuObj.top) == -5) ? -90 : -5
}
menuObj.top = (stdBrowser) ? nextPos + &quot;px&quot; : nextPos
}
-->
</script>
<style type=&quot;text/css&quot;>
<!--
.menu {font: 12pt Times New Roman,serif; background-color:#aead99; layer-background-color:#aead99;top:-90px}

#mainMenu {left:10px; width:70px;}
a {text-decoration:none; color:black}
a:hover {background-color:navy; color:white}
-->
</style>
<body bgcolor=&quot;white&quot;>
<div id=&quot;mainMenu&quot; class=&quot;menu&quot; onmouseover=&quot;toggleMenu('mainMenu', -5)&quot; onmouseout=&quot;toggleMenu('mainMenu', -90)&quot;><br />
<a href=&quot; />
<a href=&quot; />
<a href=&quot; />
<a href=&quot; />
<a href=&quot; />
<a href=&quot;javascript:toggleMenu('mainMenu')&quot;>Search</a>
</div>


</body>
</html>
</code>
i had this post originally in an asp.net forum, but now i realize my problem is js specific. ty again.
 
The immediate bug with your code is the following line:

Code:
 if (toggleMenu.arguments.length == 1 {

You have missed the closing ) bracket. The line should read:

Code:
 if (toggleMenu.arguments.length == 1
Code:
)
Code:
 {

That will hopefully stop the javascript error at least!

Jeff
 
I'm not convinced by this at all.

menuObj= (stdBrowser) ? document.getElementById(currElem).style : eval(&quot;document.&quot; + currElem)

it looks to me that this will only work in modern browsers or ie4, perhaps jeff can tell me I'm wrong? ;o)


it's friday - im tired.

simon
 
duh. i did fix that closing braket. no error on page as i can see. but still doesn't show pull-down menu. i am using ie6 and also mozilla 1.6. same in both.
being fairly new with this, i am always concerned about compatibility. maybe i should just go with traditional menu. no pull-down.
ty.
 
well, i went to a different javascript code and have a pull-down working. however, i would like to know how i can position the sub-menu to the right of the main menu. the menu intotal is a lefthand column.

i am new at this website developing and truly love doing them. so many things confuse me. i have been concentrating lately on having my code validated for every page(w3). my biggest concern is that i am missing something though as far as what different browsers are seeing. i have 2 browsers on my computer. ie6 and mozilla 1.6. i am definitely open to suggestions on how to determine if my code is working for as much of an audience as it should.

ty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top