?
Solved

printer page break and javascript iframe - help

Posted on 2005-03-17
3
Medium Priority
?
806 Views
Last Modified: 2008-02-01
Hello Experts,
I am trying to achive the page break for printer using one of the methods previously metnioned. in the Q
http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20169459.html
http://www.experts-exchange.com/Web/Web_Languages/Q_21181900.html

But when I print the javascript it does not insert the page break please guide me.

<style>
   .breakhere {page-break-after:always}
</style>

<iframe name="backFrame" id="backFrame" height="0" width="0"></iframe>
                  
                                                <input type=button value="Print" onClick="printMe(myGeneratedHTML)">

                                                      <script>
                                                      myGeneratedHTML='something<span class="breakhere"> &nbsp;</span>somethingagain'
                                                            function printMe(myGeneratedHTML) {
                                                            window.frames["backFrame"].document.write(myGeneratedHTML)
                                                            window.frames["backFrame"].document.close()  
                                                            setTimeout('window.frames["backFrame"].focus();window.frames["backFrame"].print();',100)
                                                            }
                                                      </script>


Regards,
---Pinal
0
Comment
Question by:pinaldave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Expert Comment

by:alain34
ID: 13572820
try to use these 2 changes

your style should be
page-break-before:always;

use div as opposed to span.
div is a block element, and page-break-before apply to block element, however I'm not sure span will work with it!
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 13573013
Yes, you forgot to include the style...

try

myGeneratedHTML='something<h1 style="page-break-before:always">&nbsp;</h1>somethingagain'
0
 
LVL 21

Author Comment

by:pinaldave
ID: 13575136
thank you very much mplungjan...
That worked like magic.
:)
---Pinal
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 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