Using JScript to Interact with ActiveX Controls : ActiveX « Development « JavaScript DHTML






Using JScript to Interact with ActiveX Controls


<html>
<head>
  <title>JavaScript Unleashed</title>
  <script type="text/javascript" for="CommandButton1" event="Click()">
  <!--
    var msg = "This is a button";
    var altMsg = "This is another button";
    if(CommandButton1.Caption == msg){
      CommandButton1.Caption = altMsg;
      window.defaultStatus = altMsg;
    }else{
      if(CommandButton1.Caption == altMsg){
        CommandButton1.Caption = msg;
        window.defaultStatus = msg;
      }
    }
  //-->
  </script>
</head>
<body>
  <object id="CommandButton1" width="98" height="32"
    classid="CLSID:D7053240-CE69-11CD-A777-00DD01143C57">
    <param name="VariousPropertyBits" value="268435483">
    <param name="Caption" value="This is a button">
    <param name="Size" value="209;678">
    <param name="FontCharSet" value="0">
    <param name="FontPitchAndFamily" value="2">
    <param name="ParagraphAlign" value="3">
    <param name="FontWeight"  value="0">
  </object>
</body>
</html>

           
       








Related examples in the same category

1. Accessing ActiveX Controls
2.Using ActiveX Components with JScript (Note this page requires Internet Explorer 5.0 or later)