<script language=Javascript>
var xlApp,xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Add();
xlApp.Workbooks.Open("C:\\user.xls");
</script>
var xlApp,xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Add();
xlApp.Workbooks.Open("C:\\user.xls");
</script>
与数据库一样的操作。<script>
<!--
function go() {
var rsXML = new ActiveXObject("ADODB.Recordset");
var sSQL, sConn, Path
sSQL = "SELECT * FROM 员工";
sConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Inetpub\\MyWeb\\JinHua\\xls.xls;Extended Properties=Excel 8.0;" rsXML.Open(sSQL, sConn);
document.write("<table border=\"1\" style=\"border:1px solid;\"><tr>"); for(var i=0;i<rsXML.fields.Count;i++) {
document.write("<td style=\"background:'#ffcfff';font:bold;\">" + rsXML.fields(i).name + "</td>")
}
document.write("</tr>");
while(!rsXML.eof) {
document.write("<tr>");
for(var i=0;i<rsXML.fields.Count;i++) {
document.write("<td>" + rsXML.fields(i).value + "</td>");
}
document.write("</tr>");
rsXML.MoveNext
}
document.write("</table>");
rsXML.Close();
}go();
//-->
</script>
var xlApp,xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Add();
xlApp.Workbooks.Open("C:\\user.xls");
</script>这段代码是明明有用的啊!我想你可能是没有启用ActiveX控件!