INPUT输入框灰体提示 <input type="text" value='15 words limit' style="color:#999999" onblur="inputTips_blur(this,'15 words limit')" onfocus="inputTips_focus(this,'15 words limit')"> function inputTips_focus(obj, defau
<!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><meta http-equiv="Content-Typ
1.只能输入数字,当输入不符字符删除,光标位置不变 //只能输入数字 function onlyNumTrue(obj){ var reg = /[^\d]/g; var pos = obj.selectionEnd;//获取光标位置 var val = obj.value; //获取input的值 //如果值存在不符字符将光标位置减一 if (reg.test(val)) { pos = pos - 1; 9 } $(obj).val(val.replace(/[^\d]/g, '')); o