<html>
<head>
<script>
function formatDate(e, data, separador){
var key = (window.Event)? e.which : e.keyCode;
//alert(key);
var len = data.value.length;
if(key >= 48 && key <= 57 || key == 8 || key == 0 || key == 32){
if(len == 2 || len == 5){
key != 8 ? data.value += separador : '';
}
return true;
}
return false;
}
</script>
</head>
<body>
<form action="#">
Data:<input type="text" size="15" maxlength="10" onkeypress="return formatDate(event, this, '/')">
</form>
</body>
</html>
nesse alert returna o valor do key como undefined alert(key);
e isso apenas no IE 8, aqui no trabalho uso o IE 6, e funciona perfeito.
Alguem sabe se é um bug do IE 8, ou se eles mudarão o event?