在html中,可以利用type属性来设置input只能输入数字,只需要设置type属性的值为“number”即可,语法“<input type="number">”。本教程 *** 作环境:windows7系统、HT