By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

setAttribute("oncontextmenu","contextMenu(); return false;" -Doesn't work

P: n/a
I'm trying to change the <body> 's event oncontextmenu attributes, but
am having no luck at it.

I know I can do <body oncontextmenu="contextMenu(); return false;"> but
the thing is that I set's this attribute as soon as the page
loads......which I don't to happen....I don't want to the context menu
visible until the page is done loading, and within the window onLoad
event I have a vbscript subroutine that connects to a database to pull
some info into the html body....when the subroutine is done I want it
to set the oncontextmenu attribue for the body so that my custom
context menu will be shown. My context menu gives options like Email
Report, Print Report, Refresh Data, etc......but none of these
functions will work until the initial Onload subrotine is
finished.....so that's why I don't want the the custom context menu
shown at the beginning.

the script code I was trying to use for this is:

document.getElementById("body").setAttribute("onco ntextMenu","contextMenu();
return false;")

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ItsMillerTime4u wrote:
I'm trying to change the <body> 's event oncontextmenu attributes, but
am having no luck at it.

I know I can do <body oncontextmenu="contextMenu(); return false;"> but
the thing is that I set's this attribute as soon as the page
loads......which I don't to happen....I don't want to the context menu
visible until the page is done loading, and within the window onLoad
event I have a vbscript subroutine that connects to a database to pull
some info into the html body....when the subroutine is done I want it
to set the oncontextmenu attribue for the body so that my custom
context menu will be shown. My context menu gives options like Email
Report, Print Report, Refresh Data, etc......but none of these
functions will work until the initial Onload subrotine is
finished.....so that's why I don't want the the custom context menu
shown at the beginning.

the script code I was trying to use for this is:

document.getElementById("body").setAttribute("onco ntextMenu","contextMenu();
return false;")


document.documentElement.oncontextMenu = contextMenu;

tested only in my mind......

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.