<input type="text" onkeyup="value=value.replace(/[^\d]/g,'')" />

<input type="text" onkeyup="value=value.replace(/[^\d\.]/g,'')" />