我有一个页面“summary.asp”,它运行一个sql查询来填充带有数据的html表。当我尝试向页面添加一些jquery以便我可以将html表导出为excel文件时,它就会失败。调用该功能的按钮在IE,Chrome或Firefox中无响应。任何指导都将不胜感激。
<html>
<head>
<link rel="stylesheet" href="default.css">
<link rel="stylesheet" href="header.css">
<script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"></script>
<!--This is the script that should be working the export magic-->
<script type='text/javascript'>//<![CDATA[
$(function(){
$("#btnExport").click(function (e) {
window.open('data:application/vnd.ms-excel,' + $('#dvData').html());
e.preventDefault();
});
});//]]>
</script>
</head>
<body>
<input type="button" id="btnExport" value=" Export Table data into Excel " />
</br>
</br>
<%
dim startdate
startdate = request.form("datepickstart")
dim enddate
enddate = request.form("datepickend")
%>
<strong>
Summary of Support:
<% =startdate %>
to:
<% =enddate %>
</strong>
<p>Click on individual links for more details of execution.</p>
<%
dim dbconn
set dbconn = server.createobject("adodb.connection")
dbconn.open "dsn=*****;uid=*****;pwd=*****"
'if dbconn.errors.count > 0 then
' response.write "connection erros<br>"
' for each objerr in dbconn.errors
' response.write objerr.source & "<br>"
' response.write objerr.description & "<br>"
' next
'end if
dim supportrecordset
dim sqlstr
sqlstr = SQL statement
set supportrecordset = server.createobject("adodb.recordset")
supportrecordset.open sqlstr, dbconn
%>
<div id="dvData">
<table align=center border=2 width=60%>
<tr>
<th>Summary</th>
<th>Start Time</th>
<th>End Time</th>
<th>Result</th>
</tr>
<%
while not supportrecordset.eof
response.write "<tr><td align=center>"
response.write supportrecordset("si_host") & "</td><td align=center>"
response.write "<a href=epdetails.asp?epsummid="
response.write supportrecordset("si_id")
'make the link red if the status is not success
if supportrecordset("si_status_id") = 1 then
response.write "><font color=blue><strong>"
else
response.write "><font color=red><strong>"
end if
response.write trim(supportrecordset("si_start_ts")) & "<strong></font></a></td><td align=center>"
response.write trim(supportrecordset("si_end_ts")) & "</td><td align=center>"
response.write trim(supportrecordset("st_status_description")) & "</td>"
supportrecordset.movenext
wend
supportrecordset.close
dbconn.close
%>
</table>
</div>
</body>
</html>