Dave's Brain

Browse - Programming Tips - How do I use a COM object (.OCX file) aka ActiveX in Internet Explorer?

Date: 2009jul8
OS: Windows
Keywords: IE

Q.  How do I use a COM object (.OCX file) aka ActiveX in Internet Explorer?

A.  Use <object> with your class id.

<script> var gObj; function init() { gObj = document.getElementById('myocx'); gObj.MyMethod1(); } </script> <body onload="init()"> <object classid="clsid:00000000-0000-0000-0000-000000000000" id="myocx" width="200" height="200"> </object> <button onClick="gObj.MyMethod2()">MyMethod2</button> </body>
This does *not* work in Firefox or other browsers.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.