Solved

Page brake using CCS

Posted on 2008-10-20
5
306 Views
Last Modified: 2012-05-05
Hi,
I would like to insert a page brake in a HTML page using CCS (printing purpose).
I read that is possible to do it using page-brake-after...

Here is my case:
I have several input fields in a form

<form id="printer" name="printer" method="post" action="">
<input name="field__1" type="text" id="field" size="90" value="VALUE 1" </input>
<input name="field__2" type="text" id="field" size="90" value="VALUE 2" </input>
<input name="field__3" type="text" id="field" size="90" value="VALUE 3" </input>
<input name="field__4" type="text" id="field" size="90" value="VALUE 4" </input>
 .....

Is it possible to insert a page brake after "VALUE 3" (field__3)?
0
Comment
Question by:alcani
[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
  • 2
5 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 22761715
I am not positive, and I do not have a printer around to test this out, but you may be able to if you add page-break-after as an inline style to the <input/> tag. Make sure that it is well-formatted; right now, it looks like your <input> tag is floating around without a closing >
0
 

Author Comment

by:alcani
ID: 22762264
Thank you for your answer.
May be I didnt explain my self correctly.
Im looking for inserting a page break after de <input/> tag, only when the value is VALUE 3.
Thank you for your help.
0
 
LVL 36

Accepted Solution

by:
Zyloch earned 500 total points
ID: 22762305
You can try to run something like this on window.onload:

function insertPageBreaks() {
    var inputTags = document.getElementsByTagName("input");
    for (var i = 0; i < inputTags.length; i++) {
        if (inputTags[i].value == "VALUE 3") {
            inputTags[i].style.pageBreakAfter = "always";
        }
    }
}

or something similar.
0
 

Author Comment

by:alcani
ID: 22767286
I tried that JS code. I think we are close because the loop is working ok. However inputTags[i].style.pageBreakAfter = "always" is not working. Do you know other syntax that could work?
Thank you for your help.
0
 

Author Comment

by:alcani
ID: 22768241
I'm sorry. I made a mistake. This code is working OK.
Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How Close unsubmited attempts 10 43
Popup write two lines 3 22
CSS Scroll Center with Static Side. Like EE does. 2 28
Put POST values into cookies. 14 32
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

735 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