Andrey M.
Andrey M.

Reputation: 3766

Call ActiveX method from JavaScript in IE9

I have an activex control on the page. Usually, to call it methods I use something like this:

document.getElementById('activexControlID').MethodName(2) = 'value string';

I know, that it may looks strange, but it works fine in IE6, IE7, IE8. Unfortunately, it doesn't work in IE9. It throws the error "Cannot assign to a function result".

I already tried:

document.getElementById('activexControlID').MethodName[2] = 'value string';
// and
document.getElementById('activexControlID').MethodName(2, 'value string');

but with no luck.

UPDATE

The expression document.getElementById('activexControlID').MethodName(2) = 'value string'; do not suppose to return a value. It acts like a setter. After all, I can get it later with the code var value = document.getElementById('activexControlID').MethodName(2); And I can get the value in IE9. But can not set it.

I don't know how it is implemented inside the activex control, but it is similar to array, just uses () instead of []. And once again, it works in previous versions of IE.

UPDATE 2

Looks like a bug in IE9. Hope will be fixed.

Upvotes: 3

Views: 4252

Answers (1)

Andrey M.
Andrey M.

Reputation: 3766

The bug was fixed and the code

document.getElementById('activexControlID').MethodName(2) = 'some value';

now works in the IE9 RC1.

Upvotes: 1

Related Questions