Impression d'une partie de page html
Résolu
marcelin3012
Messages postés
87
Date d'inscription
Statut
Membre
Dernière intervention
-
jean -
jean -
Bonjour, en recherchant sur la toile des script pour l'impression de mes pages, je suis tombé sur ce code. il marche mais j'aimerai que l'aperçu de la page à imprimer s'ouvre dans une nouvelle page (si possible un pop-up).
pouvez vous m'aider?
<script language="JavaScript" type="text/JavaScript">
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</script>
Code HTML:
<!--startprint-->
This area will print!
<!--endprint-->
<br />
I will not print?
<input id="btnPrint" type="button" value="Print" onclick="doPrint()" />
pouvez vous m'aider?
<script language="JavaScript" type="text/JavaScript">
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</script>
Code HTML:
<!--startprint-->
This area will print!
<!--endprint-->
<br />
I will not print?
<input id="btnPrint" type="button" value="Print" onclick="doPrint()" />
A voir également:
- Impression d'une partie de page html
- Spouleur d'impression - Guide
- Supprimer une page word - Guide
- Impression livret a5 - Guide
- Excel impression sur une page - Guide
- Editeur html - Télécharger - HTML