Adding TCHART object to HTML page using JSCRIPT
Posted: Mon Jan 16, 2006 11:36 pm
Due to a lawsuit that Microsoft lost, Microsoft will be modifying IE to perform the following: (http://www.eweek.com/article2/0,1895,18 ... x1k0000599)
IE changes will be implemented and to warn developers that users won't be able to directly interact with Microsoft ActiveX controls loaded by the APPLET, EMBED or OBJECT elements without first activating the user interface with an extra mouse click. In a white paper (http://msdn.microsoft.com/library/?url= ... ctivex.asp) microsoft identfies several mechanism to work around the changes. Fundamentally, jscript needs to be applied to insert the HTLM elements at runtime. The changes (using the CreateElement technicque) that Microsoft suggest seem to work with most ActiveX control that I have tested with; however, an IE crash occurs when using the TChart7 class id (clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E) when doing the createElement for the OBJECT (If I use other valid clsids for other ActiveX controls, everything seems to work just fine).
The code being used in the HTML test page is:
the code used in the jscript file :
When executing the jscript file, the alert message "here2" is never reached as IE fails when performing the first createElement statement. Is there anything special that needs to be done to create the TCHART html elements by jscript?
Thanks,
Scott Small
IE changes will be implemented and to warn developers that users won't be able to directly interact with Microsoft ActiveX controls loaded by the APPLET, EMBED or OBJECT elements without first activating the user interface with an extra mouse click. In a white paper (http://msdn.microsoft.com/library/?url= ... ctivex.asp) microsoft identfies several mechanism to work around the changes. Fundamentally, jscript needs to be applied to insert the HTLM elements at runtime. The changes (using the CreateElement technicque) that Microsoft suggest seem to work with most ActiveX control that I have tested with; however, an IE crash occurs when using the TChart7 class id (clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E) when doing the createElement for the OBJECT (If I use other valid clsids for other ActiveX controls, everything seems to work just fine).
The code being used in the HTML test page is:
Code: Select all
<body>
this is a test
<div id="embedControlLocation">
<script id="TChart1" src="AddTChart.js"></script>
</div>
end of test
</body>
Code: Select all
/// add TeeChart
alert('now testing type 1 of createElement using trend clsid');
var myObjectElement = document.createElement('<OBJECT id="TChart1" style="DISPLAY: none; WIDTH: 100%; FONT-FAMILY: monospace; TOP: 0px; HEIGHT: 302px" type=application/x-oleobject height="95.63%" width="96.23%" classid="clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E"></OBJECT>');
alert('here 1');
/// for testing
//var myObjectElement = document.createElement('<object id="TChart1" classid="clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E"></object>');
//var myObjectElement = document.createElement('<object id="elementid" classid="clsid:098F2470-BAE0-11CD-B579-08002B30BFEB"></object>');
var myParamElement1 = document.createElement('<PARAM NAME="Base64" VALUE="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoA5ABBkhlaWdodAP6ABJUaXRsZS5U
ZXh0LlN0cmluZ3MBBghUZWVDaGFydAAAAAAAAAACAAAAAP////8=">');
alert('here2');
myObjectElement.appendChild(myParamElement1);
alert('here3');
embedControlLocation.appendChild(myObjectElement);
alert('here4');
Thanks,
Scott Small