js表单只能填写数字和小数点

页面中有时只需要在表单中填写金额类似信息,只能有数字和小数点,input添加:onkeyup="value=value.replace(/[^\d.]/g,'')"

Tags: javascript