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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

very basic navbar submenu doesn't want to work 1

Status
Not open for further replies.

Engywook

Technical User
Apr 19, 2007
9
US
I've been able to get navbars with submenus to work numerous times with this code:

Code:
function flipIndex(whych, whereExx, whereWhyy) {
  flipOut('serviceTwo');
  flipOut('texnosTwo');
	flipOut('webApsTwo');
	document.getElementById(whych).style.zIndex=1;
	document.getElementById(whych).style.position="absolute";
	document.getElementById(whych).style.left=whereExx;
	document.getElementById(whych).style.top=whereWhyy;
	}

function flipOut(whych) {
	document.getElementByID(whych).style.zIndex=-1;
	document.getElementByID(whych).style.position="absolute";
	document.getElementByID(whych).style.left="0px";
	document.getElementByID(whych).style.top="0px";

}

Very simple stuff, and the only two functions in the script. This usually works perfectly (or at least well enough).

However, this time I only get a "Object doesn't support this property or method" error when flipOut tries to execute. If I comment out the calls to flipOut, then and only then will flipIndex execute as I'd expected (but then I'm stuck with submenus cluttering up the screen).

The real headscratcher for me is that (at least, I'm pretty darned sure), it's the same code in flipIndex and flipOut, just different parameters. Are there any reasons this would work most of the time and not in one instance. And why the exact same code, referencing the exact same objects, would be fine in flipIndex but not fine in flipOut?

My apologies if what I'm doing wrong is really stupid and obvious, but I must confess myself stumped.
 
Look closely at your code in flipOut.


document.getElementByI[!]D[/!]

The 'D's need to be lowercase.

[monkey][snake] <.
 
Yep, that was it. Thanks, I thought it was stupid and obvious but apparently over my head for a Friday.

Closing...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top