求高手写一个验证成绩的正则 onKeyUp="value=value.replace(^([1]?[1-9]?[0-9]{1})([\.]?\d?)?$ ,'')"这里我想验证成绩````但是为什么我还是能输入中文,英文还有数字呢``? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $iScore = '1313';preg_match('/[\d]{0,5}/i', $iScore, $aMatches);print_r($aMatches); 写个函数不行吗,我随便写一个,不知道有没有用:function ckscroe(num){var scroe=/^[0-9]{2,3}$/;if(!scroe.exec(num)){alert('请输入0-9数字');return false}return turn;} 貌似好像用正则表达式不能写的吧,我刚刚用JS写了一个验证方法,只能在提交的时候做判断,不能在按钮的onkeyup事件里面去实现,要是能高手能实现这个方法,也请告知,谢谢 只能输入数字<input type=text onKeyUp="this.value=this.value.replace(/[^\d]/g ,'')">以后这种非php的问题请到“WEB开发”中的相应版块发问 //js 代码function check(value){ var reg = '/^[0-9]*$/'; if(!reg.exec(value)){ alert('只能输入数字!'); } value="";}//html <input type="text" name="" value="" onKeyUp="check(this.value)"> PHP如何通过代码来新建立一个MYSQL新表 php和lighttpd如何同步输出 最基本的,php和apache的安装。 求一个正则表达式的写法 ob_end_clean 出错了,求教!!! 多个二维数组如何整合到一个数组里 $_SERVER['HTTP_REFERER']??? 最后30分了,哪位大侠看看怎么回事? 帮我看看PHP的这个配置 想自己写个blog,请问如何生成rss? 求助:极其简单的问题,大虾们都进来看一下,在线等 PHP SQL返回数组没有索引 php 用户注册问题
$iScore = '1313';
preg_match('/[\d]{0,5}/i', $iScore, $aMatches);
print_r($aMatches);
function ckscroe(num){
var scroe=/^[0-9]{2,3}$/;
if(!scroe.exec(num)){alert('请输入0-9数字');return false}
return turn;
}
<input type=text onKeyUp="this.value=this.value.replace(/[^\d]/g ,'')">以后这种非php的问题请到“WEB开发”中的相应版块发问
function check(value){
var reg = '/^[0-9]*$/';
if(!reg.exec(value)){
alert('只能输入数字!');
}
value="";
}
//html
<input type="text" name="" value="" onKeyUp="check(this.value)">