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

  • Thread starter ItsMillerTime4u
  • Start date
I

ItsMillerTime4u

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("oncontextMenu","contextMenu();
return false;")
 
R

Randy Webb

ItsMillerTime4u said:
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("oncontextMenu","contextMenu();
return false;")

document.documentElement.oncontextMenu = contextMenu;

tested only in my mind......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top