?

Log in

No account? Create an account

Previous Web | Next Web

124

OK, i *was* going to bed.. promise...

But I'm pissed off... I can't get JavaScript to do something...

OK, I want to be able to have a button (well, image) on a coloured+styled page to be able to print the page without all the colours and styles and stuff.

So I figured I'd have the button pop up another window with a nice little informative message and then either use a second frame (hidden by not having scrollbars, resize, etc) or a third window open with the plain version of the page in it. And that I'd invoke JavaScript's print() method to get the print dialog up...

This all works... I've gone for the three window version now, but I've also had the framey version working too...

The frame-based version, invoking print() against parent.frames[1] ends up with both parent.frames[0] and parent.frames[1] getting stuffed into the print queue... now that *could* be a Microsoft specific issue, but I can't do something that's gonna waste a sheet of paper for every document printed on every microsoft browser in existance... that's just *dumb* and irresponsible....

So I went to the three-window way of doing things.... and upto a point, it works fine... except now I want to close some windows.... and I can't get IE *OR* Netscape 4 *OR* Netscape 6... I can get the print dialog up in the printWindow... and it only queues the right thing now. My info window works too... it even pops back on top when the printWindow is opened like a dialog box of sorts... But I want to do:

printWindow.print()
infoWindow.close()
printWindow.close()

except it won't do it.... I get back errors about printWindow being unknown and stuff... you'd think that the browser would maintain a list of all currently open windows and their names and that there would be a message-passing mechanism so you could invoke stuff in other windows... so far as i can tell, that's actually how it's *supposed* to work... even according to Netscape 3's documentation on JavaScript, you're supposed to be able to close one window from another...

So I now have to work out a way of getting this to work some other way... which will not be easy...

Unless anyone has any ideas out there in LJ-Land...???????