easy JS question
- Started
- Last post
- 10 Responses
- fusionpixel
does anyone knows if I can print a page different than the current page?
thisotherpage.window.print()
CSS is out of the question because I dont want to recreate the whole page in CSS just for a simple line of code, I WANT THIS PROJECT TO GO AWAY!.
TIA
- imakedesign0
why would you have to rewrite the whole page???
- fusionpixel0
humm....
- heavyt0
you cannot pass a new document to the print function.
of course, i would say use a print style sheet, because that is exactly what it is made for. But i guess you dont feel liek doing that.
i suppose that you ucould rewrite teh entire document through JS triggered by the action of a button.
that isnt exactly simple either/TR1
- fusionpixel0
LOL, rewriting the document in JS? humm yummy.
Actually I just had a JS Function that detects the browser and either allows the print() function or allows you to go to printable page.
THX everyone for your valuable comments.
except for the one about "why dont you want to use CSS?" that one didnt help at all :-P
- mg330
This is a good question.
I have print page features built into many new pages on our company website. I'm soon to be working on a 100% redesign or the site, and will include print page icons on all pages.
My thought had been to attempt to do the site in full CSS. But would that affect the way a page would print?
My other thought in doing so is that I want to seperate the navigation from the content by having the content in an iframe. That way, the page print JS function is within that page, and the navigation won't print with it.
- sparker0
there are a couple of ways around this.
first, design the page using semantic markup...using proper xhtml. then style it with css.
for printing, simply disable the css for the page. it will render a page that flows like a proper 'document' instead of a web site.
or, write a simple parser in php or perl and run the content through the parser and into a secondary output window.
this would allow you to strip unwanted content like navigation, banners, etc.
the parser idea would work even smoother if you developed the page semantically as well.
this is why standards design is a good choice. especially if the site needs to be printed frequently.
- mg330
Might be a dumb question, but how does one "disable the css for the page?"
- fusionpixel0
IE or FF?
- mg330
IE
- heavyt0
much easier way is to define an alt style sheet.
set the: media=print
then, your browser will automatically use the sheet for printing. IT is completely transparent to the user. They click 'print' , and it automatically switches to a diff. stylesheet.
In that sheet, you do stuff like:
#nav{display:none;}
#content{background-color:#fff;}etc
TR1