• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

page break

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any plain html code can help me to make a page break? thanks!
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this probably only works with Internet Explorer
One of the major drawbacks of HTML is that you don't have any formatting-options when you want to print a document. But this style-hint you can force at least a page-break.
<style>.pagebreak { page-break-before: always}
.pagebreak2 { page-break-after: auto }
</style>
Response.Write("<p class='pagebreak'></p>")
Is this what you are looking for?
/Stefan
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks stefan,
but how i can include it in a html page? thanks! i really appreciated that.
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually i need to count the number of lines in the table (# of TR) and then decided to break it everytime for the table.
so is that possible to do that?
Thanks!
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jackie,
You can accomplish the counting part using the following code from O’reilly’s book – JavaScript the Definitive Guide. You’ll need to change it so it counts only the TR tags.
[CODE<head>
<script>
// This function is passed a DOM Node object and checks to see if that node
// represents an HTML tag: i.e., if the node is an Element object. It
// recursively calls itself on each of the children of the node, testing
// them in the same way. It returns the total number of Element objects
// it encounters. If you invoke this function by passing it the
// Document object, it traverses the entire DOM tree.
function countTags(n) { // n is a Node
var numtags = 0; // Initialize the tag counter
if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) // Check if n is an Element
numtags++; // Increment the counter if so
var children = n.childNodes; // Now get all children of n
for(var i=0; i < children.length; i++) { // Loop through the children
numtags += countTags(children[i]); // Recurse on each one
}
return numtags; // Return total number of tags
}
</script>
</head>
<!-- Here's an example of how the countTags() function might be used -->
<body on..load="alert('This document has ' + countTags(document) + ' tags')">
This is a <i>sample</i> document.
</body> [/CODE]
Cheers,
Dan
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks,
but i am a bit confuse that how to use the countTags. anyone can help me?
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Place this script in the <HEAD> of your html document...Hope this works.
<SCRIPT LANGUAGE="JavaScript">
for(var i = 0; i < document.getElementsByTagName('TD').length; i++);
document.write(document.getElementsByTagName('TD')[i] + "<br>")
</SCRIPT>
 
reply
    Bookmark Topic Watch Topic
  • New Topic