We recommend that you continue to apply cumulative security update 974455 and that you install update 976749 if you experience the symptoms that are described in this article. Customers who decide to remove the cumulative security update will put their systems at risk.
For the first and second scenarios that are discussed in the "Symptoms" section, you can implement a workaround if you do not want to install security update 974455. To work around the issue, explicitly declare the Array() variable into a VBScript variable. Arrays can be passed to the showModalDialog() or the showModelessDialog() methods without a "Type Mismatch" script error.
For example, the following VBScript will cause a "Type Mismatch" script error.
// TYPE MISMATCH
vReturn = window.showModalDialog("http://www.contoso.com", Array(1,2,3,4,5,6,7))
The following VBScript will pass an array to the showModialDialog() or showModelessDialog() methods without a "Type Mismatch" script error.
// NO TYPE MISMATCH ERROR
Dim myArray
myArray=Array(1,2,3,4,5,6,7)
vReturn = window.showModalDialog("http://www.contoso.com", myArray)
For the third scenario that was discussed earlier, you can implement a workaround if you do not want to install security update 974455. To work around the issue in scenarios where a single dimension Array() value is passed to the
returnValue property, use the Join and Split VBScript functions. This lets you pass Array() values to the
returnValue property.
For example, the following VBScript generates a "Type Mismatch" script error.
// TYPE MISMATCH
Dim arrayItems
arrayItems(0) = 1
arrayItems(1) = 2
arrayItems(2) = 3
Window.returnvalue = arrayItems
When you use the Join and Split VBScript functions, you can set the
returnValue property without generating a "Type Mismatch" script error.
// NO TYPE MISMATCH ERROR
Dim arrayItems
arrayItems(0) = 1
arrayItems(1) = 2
arrayItems(2) = 3
Dim arrString = Join(arrayItems, ";")
Window.returnvalue = arrString
Dim strTemp = window.showModalDialog(……)
Dim arrayItems = Split(strTemp, ";")
For the third scenario that was discussed earlier, where multidimensional Array() values or Array() values that have objects are passed to the
returnValue property, you can implement a workaround if you do not want to install security update 974455. To work around the issue in this scenario, you can use a JavaScript function to set the
returnValue property. This JavaScript function is available to VBScript subroutines and functions. Any
returnValue property value that is set by a JavaScript function will be available to VBScript.
For example, the following VBScript generates a "Type Mismatch" script error.
// TYPE MISMATCH
<script LANGUAGE=vbscript>
Option Explicit
Sub Window_OnLoad
Dim abc(1,2,3)
Window.ReturnValue = abc
End Sub
</script>
Using a JavaScript function together with an existing VBScript lets you set the
returnValue property without generating a "Type Mismatch" script error.
// NO TYPE MISMATCH ERROR
<script Language=JavaScript>
function setReturnValue(){
var returnValueArray= new Array();
returnValueArray[0] = 1;
returnValueArray[1] = 2;
returnValueArray[2] = 3;
window.returnValue = returnValueArray;
}
</script>
<script LANGUAGE=vbscript??
Option Explicit
Sub Window_OnLoad
setReturnValue()
msgbox window.returnValue
End Sub
</script>