Skulle lige producere koden til dig :). Og hvis du så kalder den fra <form> tag'en burde enter key'en ikke virke, altså:
<form action="" onkeypress="return DeactivateKey(event, 13)">
</form>
Og det hele fra før sammen med det nye "Enter" script. :)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"> <head>
<title>dato demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
function valid(field, nextFieldId)
{
var length = parseInt(field.getAttribute("maxlength"));
if(field.value.length >= length)
document.getElementById(nextFieldId).focus();
}
function DeactivateKey(e, keyNr)
{
if(!e) e = window.event;
if (e.keyCode == 13)
return false;
return true;
}
</script>
</head>
<body>
<form action="" onkeypress="return DeactivateKey(event, 13)">
<table>
<tr>
<td>dd: </td><td><input id="dd" type="text" maxlength="2" onkeyup="valid(this, 'mm');"/></td>
</tr>
<tr>
<td>mm: </td><td><input id="mm" type="text" maxlength="2" onkeyup="valid(this, 'yyyy');"/></td>
</tr>
<tr>
<td>yyyy: </td><td><input id="yyyy" type="text" maxlength="4" onkeyup="valid(this, 'btn');"/></td>
</tr>
<tr>
<td>next: </td><td><input id="btn" type="button" value="click" onclick="alert('noget');"/></td>
</tr>
</table>
</form>
</body>
</html>
:)
Mvh.
- Snap