views:

73

answers:

1

Hi,

The lines below work in IE, what do I have to do so that it works in the other browsers?

document.body.onmousedown = ContextMouseDown;
document.body.oncontextmenu = ContextShow;

Thanks, R.

+1  A: 

Works fine in firefox, assuming that you don't call these until your page is loaded:

<script>
function ContextMouseDown() {
    alert('mousedown');
}

function ContextShow() {
    alert('contextshow');
}

function loadstuff() {
    document.body.onmousedown = ContextMouseDown;
    document.body.oncontextmenu = ContextShow;
}
</script>

The important part:

<body onload="loadstuff()">
Jeff B