2010-03-25 4 views
3

Dans ce ci-dessous le programme je suis l'impression du contenu du div quand je clique sur le bouton d'impression que je reçois une erreur d'imprimante message d'alerte non disponible pourquoi il est sipourquoi mon impression ne fonctionne pas?

<html> 
<head> 
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> 
<script type="text/javascript"> 

    function PrintElem(elem) 
    { 
     Popup($(elem).text()); 
    } 

    function Popup(data) 
    { 
     var mywindow = window.open('', 'my div', 'height=400,width=600'); 
     mywindow.document.write('<html><head><title>my div</title>'); 
     /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />'); 
     mywindow.document.write('</head><body >'); 
     mywindow.document.write(data); 
     mywindow.document.write('</body></html>'); 
     mywindow.document.close(); 
     mywindow.print(); 
     return true; 
    } 

</script> 
</head> 
<body> 

<div id="mydiv"> 
    This will be printed. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a quam at nibh adipiscing interdum. Nulla vitae accumsan ante. 
</div> 


<input type="button" value="Print Div" onclick="PrintElem('#mydiv')" /> 

</body> 
</html> 

Répondre

6

Parce que votre imprimante physique est pas physiquement branché ou pas correctement installé. Le code n'est pas faux.

+0

Merci je vais vérifier – udaya

+0

lol :) :) :) :) – raj

Questions connexes