guys please help me how can I print the contents of my div in mozilla because it runs properly in opera mini and google chrome, well actually it still prints but the only content is "undefined" instead of the real contents of the div
this is my codes

<script type="text/javascript">
function printDiv() 
  var divToPrint=document.getElementById('content'); 
  newWin.document.write('<html><body onload="window.print()">'+content.innerHTML+'</body></html>'); 

<div id="content">
<input name="button" type="button" onClick="printDiv()" value="print" />

Recommended Answers

All 4 Replies

Sorry because I am new in javascript, thats why I cant understand how to integrate that @media function in my work :( can you give me some hints how can I apply that in my current codes?

Member Avatar

You don't need javascript, you need to use CSS. Read the link I gave you.

Help! now it wont work anymore, all browsers give me "undefined" as a result

Be a part of the DaniWeb community

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