javaScript to only some special combination of input strings to verify
1) the number of commas, "-" the three symbols
2) to the number at the beginning and end.
3) "-" before and after the figures must be
<script type="text/javaScript">
/*********
*only be some special char;
*/
function onlySomeChar(inputStr)
{
if((inputStr.match(/^\d.*\d$/g) && (inputStr.search(/[^0-9,-]/g)==-1)) || inputStr.match(/^\d*$/))
{
for(var i =0;i<inputStr.toString().length;i++)
{
if(inputStr.charAt(i)=="-")
{
if(isInt(inputStr.charAt(i-1))==false || isInt(inputStr.charAt(i+1))==false)
return false;
}
}
return true;
}
return false;
}
/**
*if Integer return true
*else return false;
*/
function isInt(str)
{
if (str.search(/[^0-9]/g)!=-1)
{
return false;
}
return true;
}
//the function of test
function test(strIn)
{
if(onlySomeChar(strIn)==false)
{
alert(0);
}
else
{
alert(1);
}
}
</script>
<input type="text" onchange="test(this.value)">
Related Posts of javaScript to only some special combination of input strings to verify
-
hibernate using c3p0 connection pooling
Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...
-
Hibernate configuration parameters hibernate.hbm2ddl.auto
Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...
-
Build flex + spring + blazeds + hibernate application
Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...
-
Hibernate connection pool configuration
Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.1 ...
-
hibernate generic generic DAO
hibernate generic generic DAO
-
can not be represented as java.sql.Timestamp
Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...
-
Struts2 + hibernate + spring problem user log in
dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q
-
Hibernate secondary cache
Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...
-
Hibernate's lazy strategy
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...













Leave a Reply