DaveKinnell
05-25-2003, 06:46 PM
Can anyone help me I'm after a script, or any kind of code that when a certain key is pressed (e.g ctrl) a popup message appears, similarly to the right click code below
<script name='Javascript'>
<!--
function right( val ) {
if (navigator.appName == 'Netscape' && (val.which == 3 || val.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Function disabled");
return false;
}
return true;
}
document.onmousedown = right;
document.onmouseup = right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown = right;
window.onmouseup = right;
//-->
</script>
only it works with keyboard keys. I hope this is specific enough
<script name='Javascript'>
<!--
function right( val ) {
if (navigator.appName == 'Netscape' && (val.which == 3 || val.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Function disabled");
return false;
}
return true;
}
document.onmousedown = right;
document.onmouseup = right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown = right;
window.onmouseup = right;
//-->
</script>
only it works with keyboard keys. I hope this is specific enough