Because of this problem, Google and Baidu have checked, the main solution on the Internet is this code:
<script language= "JavaScript" >varHkey_root,hkey_path,hkey_key;hkey_root= "HKEY_CURRENT_USER"; Hkey_path= "\\Software\\Microsoft\\Internet explorer\\pagesetup\\";//Set page header footer to print is emptyfunctionPagesetup_null () {Try{ varRegwsh =NewActiveXObject ("Wscript.Shell"); Hkey_key= "Header"; Regwsh.regwrite (Hkey_root+hkey_path+hkey_key, ""); Hkey_key= "Footer"; Regwsh.regwrite (Hkey_root+hkey_path+hkey_key, "");}Catch(e) {alert (e);}}//set the page header footer to print to the default valuefunctionPagesetup_default () {Try{ varRegwsh =NewActiveXObject ("Wscript.Shell"); Hkey_key= "Header"; Regwsh.regwrite (Hkey_root+hkey_path+hkey_key, "&w&b page, &p/&p"); Hkey_key= "Footer"; Regwsh.regwrite (Hkey_root+hkey_path+hkey_key, "&u&b&d");}Catch(e) {alert (e);}}functionPrintmethod () {pagesetup_default (); Window.print ();}</script>
But I tried, do not take effect, I do not know whether my project code is wrong, or the online code has a problem. Anyway all kinds of ways have tried, how JavaScript also has CSS control, and then egg.
Finally found that the Web printing generated header footer, is the browser settings, not our engineering code problems , so long as the browser is set to close the header and footer, you can!
Attached: The browser cancels the header and footer settings
IE browser (IE6 later): tool (upper right corner of the page), print, page setup, uncheck the header and footer all options in the page setup
Chrome: Tool (top right corner three dots), print, single "More Settings" on print page, uncheck ' Header footer '
About JavaScript Print Remove header footer