Regex vbscript.pattern属性在IE 10中不起作用

Regex vbscript.pattern属性在IE 10中不起作用,regex,vbscript,Regex,Vbscript,我希望有人能帮助我。我们有一个旧的VBScript应用程序,在IE 10(和11)发布之前一直运行良好。应用程序将不再接受模式属性 我们正在检查6种不同的模式,但在本例中,我只关心“Phone_2”模式 有人能帮我吗 我得到以下错误: 第32行 错误:对象不支持此属性或方法:“thisItem.pattern” 编码: 我的提交按钮 Dim strError Function doSubmit(frmID) DIM idArray, numberElements, pattern strE

我希望有人能帮助我。我们有一个旧的VBScript应用程序,在IE 10(和11)发布之前一直运行良好。应用程序将不再接受模式属性

我们正在检查6种不同的模式,但在本例中,我只关心“Phone_2”模式

有人能帮我吗

我得到以下错误:

第32行 错误:对象不支持此属性或方法:“thisItem.pattern”

编码:

我的提交按钮

Dim strError

Function doSubmit(frmID)

DIM idArray, numberElements, pattern

strError=""

ReDim idArray(document.all(frmID).length)

For x = 0 to document.all(frmID).length - 1
If document.all(frmID).elements(x).type = "text" or _
   document.all(frmID).elements(x).type = "textarea" or _
   document.all(frmID).elements(x).type = "hidden" or _
   document.all(frmID).elements(x).type = "password" then
  pattern=0
  set thisItem = document.all(frmID).elements(x)

      If lcase(thisItem.validate) <> "none" then
    If lcase(thisItem.validate)="regexp" then
     pattern=thisItem.pattern
          End If

      If thisItem.id = "sPassword" then
      If document.all(frmID).elements(x+1).id = "sVerifyPass" then
        If thisItem.value <> document.all(frmID).elements(x+1).Value then
          strError= strError & space(5) & "- Password & Verify not equal" & vbcrlf
          idArray(x)=thisItem.id
          idArray(x+1)="sVerifyPass"
        End If
      End If
    End If

    'Pass the value of the given field, the 'VALIDATE' attribute,
    'and the 'PATTERN' attribute to the validateField function
    If not validateField(thisItem.value,thisItem.validate,pattern) then
      'If the function does not return true, we add the field's
      'ID to an array.
      idArray(x)=thisItem.id
    End If
  End If
End If

Next  

'strError is defined in the validateField function
If strError <> "" then
  For each z in idArray
    If z <> "" then
      'change the background color of text fields that contain errors
      Execute("document.all." & z & ".style.backgroundcolor=""#4ebafa""")
    End If
  Next  
  strError="The following errors were found:" & space(5) _
     & vbcrlf & vbcrlf & strError
  'display errors to user
  thisBox = msgBox(strError,16,"Errors Found")        
 Else
  document.all(frmID).submit()
End If

End Function

非常感谢

哪一行是“第32行”?从IE10开始,
模式是输入元素的属性,包含一个regexp,输入元素的值将根据该regexp进行检查。也许(我可能是错的),IE和你的代码之间存在某种类型的冲突。Helen-这行'pattern=thisItem.pattern'
Function ValidateField(myValue,myValidate,myPattern)

Dim nonValid, hasChar

myValue=trim(myValue)

SELECT CASE lcase(myValidate)
CASE "regexp"               ' use a regular expression
SELECT CASE cstr(myPattern) ' Pattern Types (or your own pattern)
  CASE "phone_1" 
    myPattern="\d{3}-\d{3}-\d{4}$"
    myErr="- Phone Number must be in the format: xxx-xxx-xxxx"
  CASE "phone_2"
    If myValue = "" then
      myPattern="()"
     Else
      myPattern="\d{3}-\d{3}-\d{4}$"
    End If  
    myErr="- Phone Number must be in the format: xxx-xxx-xxxx"  
  CASE "phone_3"
    If myValue = "" then
      myPattern="()"
     Else
      If myValue = "Do Not Call" then
        myPattern="Do Not Call"
       Else
        myPattern="\d{3}-\d{3}-\d{4}$"
      End If
    End If  
    myErr="- Phone Number must be in the format: xxx-xxx-xxxx"  

  CASE "zip_1" 
    If len(myValue) <= 5 then 
      myPattern="\d{5}$"
     Else
      myPattern="\d{5}-\d{4}$"
    End If   
    myErr="- Zip code must be in proper format"
  CASE "zip_2" 
    If myValue = "" then
      myPattern="()"
     Else 
      If len(myValue) <= 5 then 
        myPattern="\d{5}$"
       Else
        myPattern="\d{5}-\d{4}$"
      End IF 
    End If   
    myErr="- Zip code must be in proper format"
    CASE "acct" 
    myPattern="\d{4}-\d{4}$"
    myErr="- Account must be in the format: xxxx-xxxx"
  CASE else 
    myPattern=myPattern
    myErr="- Field did not match the pattern '" & myPattern & "'" 
END SELECT
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
    .Pattern = myPattern
    .IgnoreCase = True
    .Global = True
End With
ValidateField = RegularExpressionObject.Test(myValue)
If validateField <> true then
  strError= strError & space(5) & myErr & vbcrlf
  validation = false
End If
Set RegularExpressionObject = nothing

END SELECT          

End Function
validate="regexp" pattern="phone_2"