Bonjour.
Je crois que le sujet a déjà été traité, mais malgré mes tentatives, mon code ne fonctionne pas.
Dans une page HML, j'ai un iframe dans lequel je charge un fichier HTML. OK.
J'ai posé un bouton d'impression et récupérer un code javscript pour effectuer l'impression mais cela ne marche pas.
Une bonne âme pourrait elle corriger mon code ?
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 <!DOCTYPE html> <html> <head> <meta content="text/html; charset=windows-1252" http-equiv="content-type"> <title>Informations</title> <script> function printPg(id) { //document.frames[ifrmname].focus(); //document.frames[ifrmname].print(); var iframe = document.frames ? document.frames[id] : document.getElementById(id); var ifWin = iframe.contentWindow || iframe; iframe.focus(); ifWin.printPage(); return false; } </script> </head> <body> <h1 style=" text-align: center;"><span style="color: #990000;"><span style="font-weight: bold;"><span style="font-style: italic;"><span style="font-family: Andalus;">SALUT LES COPAINS.</span></span></span></span></h1> <h2 style=" text-align: center;"><span style="font-weight: bold;"><span style="font-family: Andalus;">Informations, actualité.</span></span></h2> <center> <table style="width: 840px; height: 30px;" border="0"> <tbody> <tr> <td style="width: 378.567px;">En date du :<br> </td> <td style="width: 389.433px;"><br> </td> </tr> </tbody> </table> </center> <center> <table style="width: 840px; height: 40px;" border="0"> <tbody> <tr> <td style="width: 500px;">Voir le calendrier des activités <a href="Calendrier.html"><span style="font-weight: bold; color: #000099;">ICI</span></a><br> </td> <td style="width: 500px; text-align: right;"> <input type="button" value="Imprimer" onclick="printPg('zone');"> </td> </tr> </tbody> </table> </center> <div style="text-align: center;"><iframe name="zone" src="TexteAnnonce.html" height="500px" width="550px"> Votre navigateur ne supporte pas les iframes </iframe> <br> </div> <p style="text-align: center;"><br> </p> </body> </html>
Partager