Click to See Complete Forum and Search --> : Frames


roberthpike
04-02-2003, 04:10 PM
Hi All,
If I have 2 frames, one that has an application and another that has an HTML page, can I do something similar to this (if the second frame is called display)?

===================================
upper_object = window.parent.frames['display'];

var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

upper_object.document.body.insertAdjacentHTML('beforeend', WebBrowser);

upper_object.document.WebBrowser1.ExecWB(6,-1);
upper_object.document.WebBrowser1.outerHTML = "";
===================================

The reason why I say similar is because it doesnt seem to work this way. I'm only concerned on getting this to work on IE and not NS if that helps out. Basically when I run this javascript function within the first frame it prints the first frame. I'm looking to only print the second frame. Can someone please help?!?! I'd appreciate help of any form.

Rob

Jona
04-02-2003, 04:30 PM
I think you can just do window.parent.frames['display'].print();

roberthpike
04-05-2003, 08:28 AM
Hi Jona,
Using the print method actually prompts you with the print dialog box. This was the reason behind using two frames. One frame has the application running and the other is used for storing the HTML page I want to print. By inserting the object that I specified in the previous code this would allow printing the document without a print dialog showing. The frames are basically 100% and 0% wide, esentially the second frame is more of a "phantom" frame. Do you know how to access a particulat frame like I did in the previous code and apply DOM to it? Thanks for the response.

Rob

roberthpike
04-06-2003, 09:12 AM
Hey Dave,
Currently I'm at home and the application is at work. That is pretty interesting what you posted, never thought of trying that. I'll give it a try on Monday, hopefully it works. Thanks so much for the response. I'll post my results.

Rob

roberthpike
04-07-2003, 07:50 AM
Hi Dave,
Yeah that code works fine. AFTER you posted this it made total sense. I was assuming that since the Web Browser object was in the other frame and by calling the ExecWB that the other frame would print but as you pointed out it wouldnt. I should have thought more about the effects of using the print button. Thanks for the great help.

Rob

danituziel
10-20-2003, 11:19 AM
hi people
i have used the same code but i have problem when printing.

sending to printer by using:
var upper_object = window.parent.frames[1];
.
.
.
upper_object.document.WebBrowser1.ExecWB(6,-1);

printing the upper frame and not the lower frame.

what can i do to make sure it is printing only the second frame?