Operating-System Style Context Menu

I worked for a while on this, just got it to a pretty much workable state.

You guys can check it out if you want, http://develop.halfwitt.net/cursor.php

(Right click on the ‘Cyborg’ link)

(Note: it won’t work in Opera, no oncontextmenu event in Opera)

And the question?
Vinny

No question, just posting it in case someone wanted to use something similar.

Cool! I don’t have a use for it right now… But I’ve saved your file to my resources folder for later use!

Cheers! :slight_smile:

Thanks for that Jeff! It’s pretty cool.

I’ve seen this in Convea (you need to sign up for an account to access the demo) and wondered how it was done.

Wow, talk about a lot of Scripting going into that…

I’m not a fan of the loading times all the time; and I am on 1500/512 DSL!

Okay, now I am having a problem, I am using the appendChild() method to apply a table for if you have an icon for one of the options, and it is not showing up at all in IE…

It works perfectly in Mozilla, and I can see it is indeed in the source by using alert(document.body.innerHTML), but it’s just not showing up…

Any ideas?

If you are building the table dynamically, it seems like you may be forgetting to add the TBODY element. It is required in IE when building tables through the DOM.

thanks! I remember that now!

On to one of my final problems… anyone know why setAttribute(‘cellspacing’, ‘0’) and setAttribute(‘cellpadding’, ‘0’), are resulting in no changes to the table at all in IE?

I fixed the padding by applying CSS padding to 0 for each cell, but what about cellspacing?

Thanks for all the help!

Problem solved! It seems IE needs to have cellspacing and cellpadding set with camel casing:

table.setAttribute('cellSpacing', '0');
table.setAttribute('cellPadding', '0');

Impressive, I like it a lot.

It’s too bad it doesn’t work in Opera, and while there probably is methods to make it work, I believe that in a good design, the context menu would be optional in the first place, and nothing is in it that cannot be accessed by other means.

This may sound like pure madness, but does anyone have a copy of this file I posted up, haha… Total shot in the dark!

I found an old copy of it, and it actually works in Opera now which is cool, however the version I have has no icon capability, and I’d love to have that back without having to spend a retarded amount of time coding it again, haha.

EDIT: Also, I’d like to point out, after looking at my source code for this, I used to have some Javascript skills… If I tried to write this script now, I’d be lost… haha. Wow, I can’t believe how much I’d forgotten.

Jeff

In case anyone cares to take a peek at the version I do have:

http://jeff.supramania.com/cursor.php

Thanks again!

Jeff