1function exportHTML(Element) {
2 var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' " +
3 "xmlns:w='urn:schemas-microsoft-com:office:word' " +
4 "xmlns='http://www.w3.org/TR/REC-html40'>" +
5 "<head><meta charset='utf-8'><title>Anasbehhari title</title></head><body>";
6 var footer = "</body></html>";
7 var sourceHTML = header + document.getElementById(Element).innerHTML + footer;
8 var source = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(sourceHTML);
9 var fileDownload = document.createElement("a");
10 document.body.appendChild(fileDownload);
11 fileDownload.href = source;
12 fileDownload.download = 'filename.doc';
13 fileDownload.click();
14 document.body.removeChild(fileDownload);
15}
1function exportHTML(Element) {
2 var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' " +
3 "xmlns:w='urn:schemas-microsoft-com:office:word' " +
4 "xmlns='http://www.w3.org/TR/REC-html40'>" +
5 "<head><meta charset='utf-8'><title>Anasbehhari title</title></head><body>";
6 var footer = "</body></html>";
7 var sourceHTML = header + document.getElementById(Element).innerHTML + footer;
8 var source = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(sourceHTML);
9 var fileDownload = document.createElement("a");
10 document.body.appendChild(fileDownload);
11 fileDownload.href = source;
12 fileDownload.download = 'filename.doc';
13 fileDownload.click();
14 document.body.removeChild(fileDownload);
15}