|
Haver a page w/ an ActiveX object that i want to load at the end of the page load, ie, load all of my ASP page, then load the ActiveX object. Any ideas?
Pete
|
|
|
Here`s one method.
Create a page with nothing but the ActiveX object. Then in your main page, create a hidden IFRAME. Use the window.onload event to load the object source page into the IFRAME after your main page has loaded.
Sample code to demonstrate this technique. This example uses the printing control from www.meadroid.com. This is cool object that lets you strip the default browser header and footer when you print from your web applications.
First, create a page with just the object. Call this MyActiveX.html:
-----------------------------------
<object id="factory" style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=6,1,429,14" VIEWASTEXT>
</object>
-----------------------------------
Second, create the main page. This will contain the hidden IFRAME and wait until page load completes, then load the object src into the IFRAME. Name this page MyPage.html:
-----------------------------------
<script language="javascript1.2">
function DoPrint() {
self.focus();
//save existing user`s info
var factory = objectFrame.factory;
var h = factory.printing.header;
var f = factory.printing.footer;
//set header and footer to blank
factory.printing.header = "";
factory.printing.footer = "";
//print page with normal Windows print prompt
factory.DoPrint(true);
//restore user`s info
factory.printing.header = h;
factory.printing.footer = f;
}
function LoadTrigger() {
objectFrame.location = "MyActiveX.html";
}
window.onload = LoadTrigger;
</script>
<IFRAME name="objectFrame" width="0" height="0" src=""></IFRAME>
Clicking the Print button will call a javascript function that references
an ActiveX object from another window. That window happens to be a hidden IFRAME within
this page. The source of the IFRAME is not loaded until this page has finished loading.
This is handled by the window.onload event. View the source.
<p>
<input type="button" style="font-size:8pt;" value="Print" onclick="DoPrint()">
-----------------------------------
That should do it for you. Of course I suppose there may be special things in how a particular ActiveX object works that may cause issues with my method--anything is possible, eh?!
|
|
|
|
|
|
|
|
|
|
|
|