求高手写一个验证成绩的正则 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分页 网银接口开发过的朋友给我指条明路吧HIU~~ 刚接触网页设计,看到一些效果很帅,能不能帮忙解释一下怎么实现的? php, mysql5, mysqli_close关闭链接, 如何判断为有效链接. 求设计思路(基线对比) This PHP CGI binary was compiled 请提供一个匹配中文的正则表达式! 最近想写一个PHP函数库!让大家来学习PHP! 图片显示 请教PHP+MYSQL模糊查询的问题 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)">