function OpenFile() { if (document.getElementById("flUpload").value.toUpperCase().indexOf(".XLS") != -1) { var objExcel; objExcel = new ActiveXObject("Excel.Application"); objExcel.Visible = true; objExcel.Workbooks.Open(document.getElementById("flUpload").value); } else if (document .getElementById("flUpload").value.toUpperCase().indexOf(".DOC") != -1) { var objDoc; objDoc = new ActiveXObject("Word.Application") ; objDoc.Visible = true; objDoc.Documents.Open(document.getElementById("fileUpload").value); } else { alert("Please select Word/Excel file only"); return false; } }
OK. Then in IE, you can first select a word document, then click open, and the word document can be opened successfully. Isn’t it very simple? It seems that it can only be used in IE.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn