2014-04-07 39 views
1

我写了一个RegEx并试图匹配输入文本是否与它匹配。Javascript正则表达式匹配()在IE6中不起作用

var inputtxt = document.fd.pwd; 
var decimal= /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,20}$/; 

if(inputtxt.value.match(decimal)) 
{ 
    alert("Your Password confirms to New Password Rules."); 

} 
else 
{ 
    alert("Your Password must contain atleast one each of following: \n\t 1 Uppercase alphabet \n\t 2 Lowercase alphabet \n\t 3 Digit[0-9] \n\t 4 Special Character[ie !,@,#,$ etc] \n\n It SHOULD NOT conatin any Blank spaces "); 

} 

此代码工作完全在FF /铬/ IE8 +但在IE6不工作。

+6

让IE6死亡! – rekire

+4

如果你想支持IE6,你最好不要在JavaScript中尝试任何奇妙的东西......你不能有一个服务器端验证后备? (无论如何你可能会需要这个) – rednaw

+0

可能不支持lookahead。虽然不难解决。 – RobG

回答

0

Windows XP是唯一仍支持IE6的Windows平台。对Windows XP的支持终止于...好吧,看看自己here

IE6的全球使用率非常低(在中国以外),因此可以忽略不计的副作用(类似于大多数人甚至不知道的那些低使用率的浏览器)。

换句话说,支持IE6的投资回报是方式,方式,太糟糕了,甚至不会考虑这样做。只需放弃支持并继续生活,你就可以节省时间和金钱。