handling menus 
Author Message
 handling menus

Does anyone know how i can get a handle to the menu in internet explorer
through JavaScript and then cancel events if certain menu items are clicked.

For example, if someone clicks the view source button on the main IE menu is
there a way i can get a handle to this event and cancel it. I can cancel the
OnContextMenu event and prevent view source from there but i need to be able
to do it from the main menu as well

Any help will be most welcome

Thanks in advance

Neil



Fri, 27 Aug 2004 22:46:25 GMT  
 handling menus
no.
you can check for right clicks on the mouse and alert
(right click->view source)
you could check for other key events, but as far as what
they are doing in the browser menu, no, you can not.  you
could have something like this:
<script language="javascript">
var MODAL;
window.onload = function Load()
{
ModalWin('mypage.html', '', '55', '100', '750', '550',
true, true);

Quote:
}

function ModalWin(page, name, top, left, width, height,
scrollBars, Resizable)
{
  var strParam = ',height=' + height + ',top=' + top
+ ',left=' + left + ',status=no,toolbar=no,menubar=no,';

  if(Resizable)
  {
    strParam += 'resizable=yes,';
  }
  else
  {
    strParam += 'resizable=no,';
  }

  if(scrollBars)
  {
    strParam += 'scrollbars=yes';
  }
    else
  {
    strParam += 'scrollbars=no';
  }

  MODAL = window.open(page, name, 'width=' + width +
strParam);
  MODAL.onblur = RaiseModal;

Quote:
}

function RaiseModal()
{
  MODAL.focus();
Quote:
}

</script>

this way when they hit the page it raises a modal win that
does not have a menu that the user is able to get to, and
then in the page that you open, put an event handler for
if the right mouse button is clicked and disable the
ability to do such.



Sat, 28 Aug 2004 03:06:33 GMT  
 handling menus
thanks that works great, any ideas how to pick up the oncontextmenu event in
netscape though, ive managed to trap the click event, and the dblclick
event.

But when you dblclick it still show the context menu rather than return
false;

document.onclick=event;

function event(e)
{
    if (e.which == 3)
        return false;

    return true;

Quote:
}

function captureDocumentEvent()
{
    document.captureEvent(Event.CLICK);
    document.captureEvent(Event.DBLCLICK);

Quote:
}

Netscape doesnt have an oncontextmenu event so if anyone knows the solution
to this then id be grateful for you help.

Regards and thanks

Neil

Quote:
> no.
> you can check for right clicks on the mouse and alert
> (right click->view source)
> you could check for other key events, but as far as what
> they are doing in the browser menu, no, you can not.  you
> could have something like this:
> <script language="javascript">
> var MODAL;
> window.onload = function Load()
> {
> ModalWin('mypage.html', '', '55', '100', '750', '550',
> true, true);
> }

> function ModalWin(page, name, top, left, width, height,
> scrollBars, Resizable)
> {
>   var strParam = ',height=' + height + ',top=' + top
> + ',left=' + left + ',status=no,toolbar=no,menubar=no,';

>   if(Resizable)
>   {
>     strParam += 'resizable=yes,';
>   }
>   else
>   {
>     strParam += 'resizable=no,';
>   }

>   if(scrollBars)
>   {
>     strParam += 'scrollbars=yes';
>   }
>     else
>   {
>     strParam += 'scrollbars=no';
>   }

>   MODAL = window.open(page, name, 'width=' + width +
> strParam);
>   MODAL.onblur = RaiseModal;
> }
> function RaiseModal()
> {
>   MODAL.focus();
> }
> </script>

> this way when they hit the page it raises a modal win that
> does not have a menu that the user is able to get to, and
> then in the page that you open, put an event handler for
> if the right mouse button is clicked and disable the
> ability to do such.



Sun, 29 Aug 2004 00:46:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. menus and sub-menus and sub-sub-menus

2. Mouseover menus, & ms menus

3. Sub Menu - Child Menu

4. Slow Menu load on ASPX page (menu as control)

5. Context/Regular Menus

6. Open Browser without Menu, Nav or Address Bars

7. drop down menu

8. Accessing the IE Menu

9. Stop browser's popup menu

10. IE SaveAs menu items not appearing

11. Accessing the 'File' menu

12. menu/list question (simple)

 

 
Powered by phpBB® Forum Software