Slyck.com
 
Slyck Chatbox - And More

Website Menus

A place for developers and programmers of file-sharing software to discuss issues.
Forum rules
PLEASE READ BEFORE POSTING: Slyck Forum Rules

Website Menus

Postby Ooble » Mon Jul 05, 2004 9:00 pm

Hi there. This is the first post - I feel special. Anyhoo, on to my problem. I'm trying to create a sliding menu for a website. Unfortunately, I'm the sort of person who likes to understand the code he's using, but some of the stuff out there makes no sense. Can anyone give me some basic code that makes a floating table appear when I pass the mouse over a link or something?
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Postby Drake » Mon Jul 05, 2004 9:13 pm

Are you coding this menu in Javascript?

Check out this menu: http://dynamicdrive.com/dynamicindex1/slideinlink.htm

The code has comments.
User avatar
Drake
 
Posts: 2060
Joined: Tue Aug 05, 2003 12:56 pm
Location: Meepos (where charging for MP3s is illegal!)

Postby Ooble » Mon Jul 05, 2004 9:23 pm

It doesn't seem to do anything. It wasn't what I was looking for either. I've been doing some thinking, and all I need to know is how to make a table visible and invisible at will. The rest'll be easy.
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Postby Drake » Mon Jul 05, 2004 9:28 pm

You have to click on the Menu for it to slide over. I know it's not exactly what you wanted, but I thought the code might help.

I think you can create the menu you want in a similar way that menu was coded. Create an IF statement inside a function that's triggered by a mouseover event.

You should link to the menu when you're finished so we can all check it out.
User avatar
Drake
 
Posts: 2060
Joined: Tue Aug 05, 2003 12:56 pm
Location: Meepos (where charging for MP3s is illegal!)

Postby Ooble » Mon Jul 05, 2004 10:00 pm

It's not finished, but I managed to get it working. Unfortunately, it only works in IE, because the code I used was direct from the MSDN. This is the code I used:

Code: Select all
onMouseOver="menu1.style.visibility='visible'" onMouseOut="menu1.style.visibility='hidden'"


menu1 is just a selection of links, bundled up in a div tag with the id menu1. Any idea on how to make this cross-browser compatible?
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Postby Drake » Tue Jul 06, 2004 11:52 am

Try this for Netscape compatability:

visibility:show;
visibility:hide;
User avatar
Drake
 
Posts: 2060
Joined: Tue Aug 05, 2003 12:56 pm
Location: Meepos (where charging for MP3s is illegal!)

Postby Ooble » Tue Jul 06, 2004 4:23 pm

So how do I change the stylesheet in the above events?
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Postby Ooble » Tue Jul 06, 2004 9:28 pm

OK... I've been doing a lot of fiddling. All I need to know is where to put this event:

Code: Select all
onClick="document.getElementById('menu1').style.visibility='hidden'"

so that wherever I click, the event executes. Anyone in the know?
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Website Menus

Postby SlyckChuck » Wed Jul 07, 2004 5:32 pm

Isn't nutscrape lower that IE??? I remember many complaining about that browser.
The 80's Still Rule
User avatar
SlyckChuck
 
Posts: 7025
Joined: Sun Jan 18, 2004 12:57 pm
Location: On Earth

Postby nebin333 » Wed Jul 07, 2004 5:42 pm

Netscape compatability. That means Mozilla and Firefox.
"For reason, ruling alone, is a force confining; and passion, unattended, is a flame that burns to its own destruction." -Khalil Gibran
User avatar
nebin333
 
Posts: 175
Joined: Sun Apr 25, 2004 3:52 pm
Location: US

Postby Ooble » Wed Jul 07, 2004 5:59 pm

Don't worry - I've got it working. Took a bit of JavaScript. If anyone wants the code to make something happen no matter where you click, post and I'll demonstrate.
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.

Postby Drake » Wed Jul 07, 2004 6:42 pm

I'd like to see your code.
User avatar
Drake
 
Posts: 2060
Joined: Tue Aug 05, 2003 12:56 pm
Location: Meepos (where charging for MP3s is illegal!)

Postby Ooble » Wed Jul 07, 2004 8:25 pm

OK, here we go. First, create a function that does whatever you want it to do, and put it in script tags in the head:

Code: Select all
<script>
<!--

function x() {
    // insert code here
}

// -->
</script>

Then place this code inside those script tags:

Code: Select all
if (parseInt(navigator.appVersion) > 3) {
   document.onmouseup = x;
   if (navigator.appName=="Netscape")
      document.captureEvents(Event.MOUSEDOWN);
}

Just replace x with your function name. I used this to hide a menu that popped up when you click a button - it's pretty useful.

(code above courtesy of Google and someone helpful in some forum)
[code:1]char str[20];
scanf("%19s", &str);
if (!strcmpi(str, "Hello, world!"))
printf("Hello, programmer.\n");[/code:1]
User avatar
Ooble
 
Posts: 2372
Joined: Sat Dec 06, 2003 9:33 am
Location: Wouldn't you like to know, SlyckTom? Just so you can sell my address to the RIAA? No chance.


Return to Developers Forum

Who is online

Users browsing this forum: No registered users and 2 guests

© 2001-2008 Slyck.com