This problem is resolved. It seems the onClick function and using an alert on newer versions of IE will cause the problem described below.
-–
Hi there, I have a problem when trying to implement my own onClick event with the ImageViewer ActiveX Component. My ImageViewer ActiveX object is created in Javascript and appended to the DOM. Then, I call the following function to enable the call of the onClick event when the left mouse button is clicked on the ImageViewer.
imageViewer.SetOnClickEventStatus(true);
After that, I create a script to indicate which Javascript function to call when the ImageViewer onClick event is called.
var lScript = document.createElement(“script”);
lScript.type = “text/javascript”;
lScript.htmlFor = “imageViewer”;
lScript.event = “onClick()”;
lScript.appendChild(document.createTextNode(“onClick();”));
this.mContainer.appendChild(lScript);
function onClick()
{
alert(‘Hi!’); // Just a test to see if the function is being fired.
}
Something interesting then happens. Once the camera feed is being displayed, if I click on the ImageViewer component, the alert popup is being displayed. Great! However, after I close the popup, If I click anywhere else (and I mean anywhere, even on the IDE on my other monitor) or anywhere else on the page, the function is being fired again and the alert message keep popping up, even if I am not clicking on the ImageViewer component anymore.
The first time works as intended. If I open the page, let the component load and click anywhere, it won’t do anything. But as soon as I click the component and the function gets called, then any click, anywhere, will call the function again.
Any idea why this might be happening?