UBB.Dev
Posted By: CTM My tabbed menu doesn't work... - 01/12/2004 2:45 AM
http://www.iphq.net/tpmbot/?tab=3

The main menu at the top of the page works fine, but on the Commands tab, clicking one of the command names to bring up more information about it (in the space below the command list) brings up a JS error. The weird thing is, though, that the page actually loads, displays and works fine.

I asked Al, but he wasn't certain what was wrong. Could someone else take a look please? confused
Posted By: Charles Capps Re: My tabbed menu doesn't work... - 01/12/2004 2:55 AM
Error: document.getElementById(commands[i]) has no properties
Source File: http://www.iphq.net/tpmbot/nav.js
Line: 18

Has no properties -> undefined.

When defining it inside the HTML file, don't use var to declare it. var is sorta like Perl's my - it scopes to the local block. By dropping off the var, you create it globally, which should work better...
Posted By: CTM Re: My tabbed menu doesn't work... - 01/12/2004 6:48 PM
Thanks Charles. smile

Got rid of the vars from all of the variables I set in the HTML header (I was accessing the other variables through nav.js too, so it's for the best). But unfortunately the JS error is still appearing. frown

I thought it might have something to do with the use of the return false; function (or maybe just return) twice in the same script, but I'm probably wrong...
Posted By: CTM Re: My tabbed menu doesn't work... - 01/12/2004 7:04 PM
Uhh... Okay, I understand the problem now. I hadn't defined everything in the commands variable. God, it all makes sense when you enable higher-level script debugging... tipsy

Thanks again, Charles, you put me on the right line to my mistake. The variable was the problem, not the code. smile
Posted By: Charles Capps Re: My tabbed menu doesn't work... - 01/13/2004 3:54 AM
Aha, looks pretty good now... though you'll want to examine it in 800x600 or so. The tabs at the top are wrapping...

You also might want to look at adding

cursor: pointer;
cursor: hand;

to the CSS rule for the descrptive not-quite-links so that they "feel" clickable.
Posted By: CTM Re: My tabbed menu doesn't work... - 01/13/2004 8:22 PM
Ah, you're right, it does look disguesting at 800x600. I made the font size on the tabs 10pt now, it looks much better at 1024x768 too. smile

And I thought you could only change cursors using JavaScript in IE... Meh, just goes to show how stupid I am, I guess. wink

Oh, and that reminds me, I thought I'd credited solareclipse in the HTML comment, but I hadn't... It's in there now. wink
Posted By: Charles Capps Re: My tabbed menu doesn't work... - 01/13/2004 9:05 PM
Thanks. wink
© UBB.Developers