PDA

View Full Version : Context Menu Help



AngelxWings
11-08-2005, 02:01 AM
Hey guys! I'm using the Context Menu [first addition!]

http://www.dynamicdrive.com/dynamicindex1/contextmenu.htm

And so far, through research and finding codes, I've found some like:

<div class="menuitems" url="javascript:location.reload()">Refresh</div>
or
<div class="menuitems" url="javascript:window.close()">Close</div>

[these are used in the context menu]

The functions for these is when you right-click and click on Refresh, the page will refresh. If you right-click and click Close, the window will close. However, I cannot find the 'Paste' and 'Copy' option that will work in the Context Menu. I tried stuff like:

<div class="menuitems" url="javascript:window.copy()">Copy</div>

But so far I have no luck in finding a way to put a copy or paste button into the Context Menu.

Can someone please help me find the javascript for copying and pasting? Much appreciation. :)

jscheuer1
11-08-2005, 03:55 AM
Think about what you are doing first. All modern browsers have perfectly good context menus for those sort of things. Also many will not or can be set not to allow this type of context menu substitution. Also, emulating Paste and Copy are much more involved than simple commands such as the ones for close() and reload(). The close() method generally will not work unless the window was opened using javascript's open() method. If you insist, check out this thread from another forum I sometimes post in:

http://codingforums.com/showthread.php?t=65106

As I recall, we made quite a bit of progress in IE doing this and I believe someone else chimed in with ideas on how to do it in other browsers as well.