Solved

Page brake using CCS

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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…

707 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