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

Discussion in 'Javascript' started by ItsMillerTime4u, Mar 3, 2005.

  1. 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;")
    ItsMillerTime4u, Mar 3, 2005
    #1
    1. Advertising

  2. ItsMillerTime4u

    Randy Webb Guest

    Re: setAttribute("oncontextmenu","contextMenu(); return false;" -Doesn'twork

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


    document.documentElement.oncontextMenu = contextMenu;

    tested only in my mind......

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Mar 4, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    7
    Views:
    14,703
    John C. Bollinger
    Nov 8, 2004
  2. Chris Tomlinson
    Replies:
    9
    Views:
    474
    Randy Webb
    Jul 25, 2006
  3. Luc
    Replies:
    2
    Views:
    979
  4. Terri I.
    Replies:
    0
    Views:
    103
    Terri I.
    Aug 13, 2003
  5. RC
    Replies:
    5
    Views:
    239
    Laurent Bugnion
    Oct 4, 2006
Loading...

Share This Page