function KeyFilter(type)
{
var berr=false;
switch(type)
{
case ''date'':
if (!(event.keyCode == 45 || event.keyCode == 47 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case ''number'':
if (!(event.keyCode>=48 && event.keyCode<=57))
berr=true;
break;
case ''cy'':
if (!(event.keyCode == 46 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case ''long'':
if (!(event.keyCode == 45 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case ''double'':
if (!(event.keyCode == 45 || event.keyCode == 46 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
default:
if (event.keyCode == 35 || event.keyCode == 37 || event.keyCode==38)
berr=true;
}
return !berr;
}
<input type="text" id="tb_tag" runat="server" onkeypress="return KeyFilter(''double'');" />