javascript验证以检查正确的字符串格式 [英] javascript validation to check correct string format
本文介绍了javascript验证以检查正确的字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var _selOGC = document.getElementById('<%= this.txtOGCCommand.ClientID %>').value;
var _ogc = _selOGC.indexOf("$IT+");
if (parseInt(_ogc) != 1)
{
alert ('<%= this.GetGlobalResourceObject("resOGCommand","validOGC") %>');
document.getElementById('<%= this.txtOGCCommand.ClientID %>').focus();
//return false;
}
< br $>
i a a module命名为ogc wen我添加了一些垃圾而不是$ IT +它会弹出一个msg说请添加有效的ogc
如果我添加正确的格式并保存它ll显示相同的弹出消息但数据将保存。
哪里有mi进入脚本?
i ve a module named ogc wen i add some junk other than "$IT+" it will pop up a msg saying please add valid ogc
wen i add proper format and save it ll display same pop up msg but the data will be saved.
where m i going in the script?
推荐答案
IT +);
if (parseInt(_ogc)!= 1 )
{
alert(' <%= this.GetGlobalResourceObject(resOGCommand,validOGC)%>');
document.getElementById(' <%= this.txtOGCCommand.ClientID%>')。焦点();
// 返回false;
}
IT+"); if (parseInt(_ogc) != 1) { alert ('<%= this.GetGlobalResourceObject("resOGCommand","validOGC") %>'); document.getElementById('<%= this.txtOGCCommand.ClientID %>').focus(); //return false; }
b / b
$ b $两个名为ogc的模块我添加一些除了
i ve a module named ogc wen i add some junk other than "
IT +以外的垃圾它会弹出一个msg说请添加有效的ogc
我要添加正确的格式并保存它ll显示相同的弹出消息但是数据会被保存。
哪里有mi进入剧本?
IT+" it will pop up a msg saying please add valid ogc
wen i add proper format and save it ll display same pop up msg but the data will be saved.
where m i going in the script?
试试
try
if (parseInt(_ogc) != -1)
这篇关于javascript验证以检查正确的字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文