faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

61 of 84 people (73%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

I have created a visual ActiveX object in javascript. How do I display this in my HTML page?

Apr 4th, 2008 20:41
ha mo, Mark Szlazak, Rachael Oldmeadow,


To embed a Visual ActiveX object in a page, you use the <OBJECT> tag. 
Here's an example with a Windows Media Player and an Excel spreadsheet.
<HTML><HEAD></HEAD>
<BODY>
<OBJECT ID="WMPlayer" CLASSID="CLSID:6BF52A52-394A-11D3-B153-
00C04f79FAA6">
<PARAM NAME="autoStart" VALUE="True">
</OBJECT>
<OBJECT ID="xlSheet"
        CLASSID="CLSID:0002E510-0000-0000-C000-000000000046">
</OBJECT>
</BODY>
</HTML>
The CLASSID attribute for a particular object, example the Windows 
Media Player, can found with the Registry Editor (regedit.exe) by 
choosing Edit/Find and searching for "Windows Media Player" in the 
CLSID subfolder of the HKEY_CLASSES_ROOT folder of the registry.
Keep pressing F3 (Find Next) until the editor lands upon a folder whose 
default value (in the right side of the Registry Editor window) 
shows "Windows Media Player". The number inside the curly braces next 
to the highlighted folder is the one assigned to CLASSID.
Here's how you can get all the parameters of an object. I'll use an 
embedded Excel spreadsheet in this next script. Look 
at "MySpreadsheet.innerHTML=" to get the embedded sheets properties.
<HTML>
<HEAD><SCRIPT>
function showProperties() {
  var objName = "MySpreadsheet";
  obj = eval(objName);
  var msg = "";
  for (var i in obj) {
    try {
      // work around bug in IE
      if (i != "domain") msg += objName + "." + i + "=" + obj[i] + "\n";
    }
    catch(e) {}
  }
  form.output.value = msg;
}
</SCRIPT></HEAD>
<BODY>
<OBJECT ID="MySpreadsheet"
        CLASSID="CLSID:0002E510-0000-0000-C000-000000000046">
</OBJECT>
<FORM NAME="form">
<TEXTAREA NAME="output" COLS="80" ROWS="10" WRAP="virtual"></TEXTAREA>
<INPUT TYPE="Button" VALUE="Show Properties" ONCLICK="showProperties()">
</FORM>
</BODY>
</HTML>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com