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


kurtatwork
05-24-2003, 03:01 PM
Ok, here's what I'm trying to do ...

I'm not interested in my own print button/function using "window.print()". I'm working with the Print function built into IE. I've got two frames, one for navigation and one for content.

When the user presses one of my nav buttons the focus is of course in the nav frame, but if he then clicks on the stock IE print function, by default the only thing that will print is the frame where the focus is (nav). The target audience for this website is older unsophisticated users so I dont want them having to use the "print preview" function or the "options" from the print dialogue box to change the IE defaults so that the content frame will print and not the nav frame.

I've tried to get around this by doing the following:

On the FRAMESET I inserted: onbeforeprint="myPrint();"

Then the Javasript looks like:

function myPrint() {
mf = window.parent.frames['mainFrame'];
nav = window.parent.frames['navFrame'];
alert(parent.document.activeElement.name);
nav.blur();
mf.focus();
alert(parent.document.activeElement.name);
}


The alerts show me that indeed the change of focus seems to be taking place to the content frame, but when I get into the print dialogue its obvious that the Nav frame is still getting passed as the "selected" frame, so the only way to get the content (mainFrame) frame to print out is by altering the print options, and most unskilled users dont have a clue about this.

Help!?!?! This is driving me insane.

-kurt

khalidali63
05-24-2003, 03:07 PM
why not add a print button in the frame you want to print,that will be (my opinion) easier for elderly people and will give them one less click to click..:-)

kurtatwork
05-24-2003, 03:11 PM
Originally posted by khalidali63
why not add a print button in the frame you want to print,that will be (my opinion) easier for elderly people and will give them one less click to click..:-)

Yup, its starting to look like thats the best option. But just in case they dont see the print button/icon, or they're used to using the Print function of the browser (like me) ... I wanted to try and solve this selected frame situation.

kurtatwork
05-25-2003, 02:58 PM
Ok, it appears that no one's got any idea about an elegant solution .... so I was just about to give up when I came up with a clever solution instead. I'd prefer elegant, but I'll take what I can get.

Instead of working thru the onBeforePrint event, I just added a change of focus to each of my nav buttons, so that when any of them generate a click event, I change the focus from the nav frame back to the content frame. Then when the browsers' print function is executed the focus is already back in the content frame where I want it and the default frame to be printed is the content frame.

Just an FYI in case anyone else is dealing with this issue.

-kurt