hi

I have the following which brings up the print window for my page, however, I would only like to print the "echo" form data which is being displayed and not the entire page.

any suggestions would be greatly appreciated :-)

Thank you

<script>
function printpage()
{
window.print();
}
</script>



<input type="button" value="Print this page" onclick="printpage()" />

Recommended Answers

All 4 Replies

Thank you. I have tried adding this, but it dosn't seem to be correct

<style>
@media screen
  {
  .$_POST['telNo']. {font-family:verdana,sans-serif;font-size:14px;}
  }
@media print
  {
  .$_POST['telNo']. {font-family:times,serif;font-size:10px;}
  }
@media screen,print
  {
  .$_POST['telNo']. {font-weight:bold;}
  }
</style>
<script>
function printpage()
{
window.print();
}
</script>

<input type="button" value="Print this page" onclick="printpage()" />

you should put first the form inside a div and add a javascript to print only the object inside the div you can search google or other search engine to give you some ideas on how to do it..

javascripts may not work, many users block javascript as security issue
css is easier

@media print { .dontprint {display:none;} }
@media screen { .dontshow{ display: none; }}

anthing you dont want to print is 'class="dontprint" '
a set of separate page headers and text to complete a printed page that does not show onscreen is the 'dontshow' class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.