Solved

Page brake using CCS

Posted on 2008-10-20
5
300 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
  • 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now