When I was working on the Campus Network Homepage of Hubei University, there was a printing function in this week's conference topic, mainly through marking a printing start marker and a ending marker on the webpage, use the string method to intercept the characters between the two marker, and finally use window. print () method for printing!
PasteCode:
<SCRIPT type = "text/JavaScript"> function printhytz () {bdhtml = Invalid Response Doc ument. Body. innerhtml; // obtain the entire page string sprnstr = '<! -- Beginprint --> '; eprnstr =' <! -- Endprint --> '; prnhtml = bdhtml. substr (bdhtml. indexof (sprnstr) + 17); // obtain the string prnhtml = prnhtml. substring (0, prnhtml. indexof (eprnstr); // obtain the string of the specified region. body. innerhtml = "<br> <font style = 'font-size: 14px; font-family:; '>" + prnhtml + "</font> "; // reset the webpage content window. print (); // call the print () method of the window object to print.} </SCRIPT> <! -- Beginprint --> area to be printed <! -- Endprint -->