JavaScript DHTML/Development/ActiveX

Материал из Web эксперт
Версия от 07:19, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Accessing ActiveX Controls

<HTML>
<HEAD>
<TITLE>Accessing ActiveX Components</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function accessActiveX() {
 var newValue = (1000*Math.random()) % 101
 ProgressBar1.Value = newValue
 Slider1.Value = newValue
}
</SCRIPT>
</HEAD>
<BODY onLoad="setInterval("accessActiveX()",2000)">
<P><I>Note this page requires Internet Explorer 5.0.</I></P>
    <OBJECT ID="ProgressBar1" WIDTH=400 HEIGHT=33
     CLASSID="CLSID:0713E8D2-850A-101B-AFC0-4210102A8DA7">
        <PARAM NAME="_ExtentX" VALUE="10583">
        <PARAM NAME="_ExtentY" VALUE="873">
        <PARAM NAME="_Version" VALUE="327682">
        <PARAM NAME="Appearance" VALUE="1">
    </OBJECT>
<P>
    <OBJECT ID="Slider1" WIDTH=400 HEIGHT=33
     CLASSID="CLSID:373FF7F0-EB8B-11CD-8820-08002B2F4F5A">
        <PARAM NAME="_ExtentX" VALUE="10583">
        <PARAM NAME="_ExtentY" VALUE="873">
        <PARAM NAME="_Version" VALUE="327682">
        <PARAM NAME="Max" VALUE="100">
    </OBJECT>
</BODY>
</HTML>



Using ActiveX Components with JScript (Note this page requires Internet Explorer 5.0 or later)

<HTML>
<HEAD>
<TITLE>ActiveX Demo</TITLE>
</HEAD>
<BODY>
    <OBJECT ID="ProgressBar1" WIDTH=400 HEIGHT=33
     CLASSID="CLSID:0713E8D2-850A-101B-AFC0-4210102A8DA7">
        <PARAM NAME="_ExtentX" VALUE="10583">
        <PARAM NAME="_ExtentY" VALUE="873">
        <PARAM NAME="_Version" VALUE="327682">
        <PARAM NAME="Appearance" VALUE="1">
    </OBJECT>
<P>
    <SCRIPT LANGUAGE="JavaScript" FOR="Slider1" EVENT="Change()">
<!--
ProgressBar1.value = Slider1.value
-->
    </SCRIPT>
    <OBJECT ID="Slider1" WIDTH=400 HEIGHT=33
     CLASSID="CLSID:373FF7F0-EB8B-11CD-8820-08002B2F4F5A">
        <PARAM NAME="_ExtentX" VALUE="10583">
        <PARAM NAME="_ExtentY" VALUE="873">
        <PARAM NAME="_Version" VALUE="327682">
        <PARAM NAME="Max" VALUE="100">
    </OBJECT>
<P><B>Move the slider and watch the progress bar change.</B></P>
</BODY>
</HTML>



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>