Solved

Pop Up Window with Contents of Div

Posted on 2013-12-11
4
374 Views
Last Modified: 2013-12-11
I'd like to know the best way to be able to click a button called print that will pop up a new window with the contents of a div on the current page to be printed.
0
Comment
Question by:N R
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 39712149
You don't really need a new window.  Just use an @media print in the stylesheet

@media print
  {
     style rules here
  }

Then set everything you don't want to print to display:none, and apply any special style you need to the div for optimum printing.

for the button you just need onclick="window.print();"

Cd&
0
 
LVL 11

Author Comment

by:N R
ID: 39712524
For this solution I need to have it open in a new window.
0
 
LVL 11

Author Comment

by:N R
ID: 39712528
Nevermind, I see what you mean now, it opens it into a print view anyways almost like a popup window.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
iframe - style elements within an iframe 7 36
Button function on table is in trouble 3 22
Wordpress Only run code if on a certain page 11 23
2 separate CSS animations 2 17
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question