jsp regular expression problem neighborhoods brother beginner

Category: Web Develop
 
china5771
2009-11-30 12:34:13

Sponsored Links
For example I want my phone number registration page can only be 11 figures how to write it in the jsp pages written in JavaScript or in java class to write it?

just written message board when a friend told me that JavaScript code can attack, I used to try really alert message box pop out, how to solve this ? How to write a regular expression?


Sponsored Links

luoxuewuhen0704
2009-11-30 12:46:07
on the page using js checks, as
<input TYPE="TEXT" id="sample" maxlength="11" onblur="check();"> 
<script language="javascript" type="text/javascript"> 
function check(){ 
var reg = /\d{11}/g;
var value = document.getElementById('sample').value;
if (!value.match(reg)) {
alert(' 11 ');
document.getElementById('sample').focus();
}
}

after submission servers still have to check again .
liushishao
2009-11-30 12:54:21
last less preceding code line

</script>
lengshou01
2009-11-30 01:00:44
javascript judgment in the foreground, java judgment in the background, doing hands ready, as the wording of the regular expression, lz can go online to search, a lot of!
jw731
2009-11-30 01:17:38
mostly see to understand, but not quite sure how to use.
jhksbc
2009-11-30 01:29:47
is not [0-9] {11} it

javascript and server sides do check ~
jbgy123126com
2009-11-30 01:40:56
Regular I probably have written expressions to see to understand, but I do not know how should I use, you can help me write a simple example that you
zcx_hi
2009-11-30 01:50:14
Thank you very much I just want this
zcszhang
2009-11-30 02:01:09
\ \ d * {11}
[0-9] * {11}
both are okay
schon1
2009-11-30 02:10:48

plus * superfluous
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.