Invoking Print Preview of iFrame contents, not the whole frameset
Posted on 2007-11-13
Ok, in the following code it invokes print preview. The .aspx page I'm working with is a page that contains 4 different iframes. I would like to do print preview of just the contents in iFrame #4, but when this code is executed it's giving a print preview of the main page that contains the 4 iframes. That's the problem.
I've tried lots of stuff, but I can't figure it out.
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
var PROMPT = 2; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
top.frames.printFrame.WebBrowser1.outerHTML = "";
the code after the WebBrowser declaration says "top.frames.printFrame". I added that there to try and specify that I only wanted to embed the browser object in the iframe named "printFrame" (iframe #4), but it doesn't do anything differently. It could be the same thing without that, obviously.
Help is much appreciated.