ex1)
// Firefox
function keyCode(e)
{
alert(e.which);
}
// IE
function KeyCode()
{
alert(event.keyCode);
}
// cross browsing
document.onkeypress = function(e){
var result = "";
if (typeof(e) != "undefined")
result = e.which;
else
result = event.keyCode;
alert(result);
}
=============================
ex2)
if (window.event) {
// IE
var ev = window.event.keyCode;
}
else
// Firefox, Orera etc.
var ev = e.keyCode;
}
=============================
ex3)
function click(e) {
if (e == null) {
if (event.button == 2 || event.button == 3) {
alert('Do not use the fucking right button!!');
return false;
}
}
else {
if (e.button == 2 || e.button == 3) {
alert('Do not use the fucking right button!');
return false;
}
}
}
function keypressed(e) {
if (e == null) {
if (event.keyCode > 0) {
alert('Do not use the fucking keyboard!');
}
}
else {
if (e.keyCode > 0) {
alert('Do not use the fucking keyboard!');
}
}
}
document.onkeydown = function(e) {
if (typeof(e) != "undefined")
keypressed(e);
else
keypressed();
}
document.onmousedown = function(e) {
if (typeof(e) != "undefined")
click(e);
else
click();
}
Are you still using the fucking IE?
That's rubbish! You know where the rubbish should go.
Rubbish Internet Explorer.
No comments:
Post a Comment