我的网站上,让游客使用此代码下载各种文件的工作:怎么算下载的文件
<input type="button" class="downloadedFile" value="Download File" onclick="window.location.href=\'documents/' . $docsRow['docFileName'] . '\'" />
$ docsRow [“docFileName”]为每个文件,这是路径从MySQL数据库中检索。
大局观,这些文件是在一个jQuery的手风琴,每个手风琴窗格与一个或多个文档类 - 像这样的:
<div id="accordion">
<h3><a href="#">LEAD5220 - Leader as Change Agent</a></h3>
<div>
<p class="className">Leader as Change Agent</p>
<p class="classNumber">LEAD5220</p>
<hr class="classSeparator" />
<table width="95%">
<tr>
<td><strong>Document Name:</strong> Generic Annotation Format</td>
<td width="100px" align="right"><input type="button" class="downloadedFile" value="Download File" onclick="window.location.href='documents/Generic Annotation Format.docx'" /></td>
</tr>
<tr>
<td colspan="2"><strong>Description:</strong> This document can be used as a template for your annotations in the annotated bibliography forums.</td>
</tr>
</table>
<hr class="classSeparator" />
...
我的客户希望能够指望的数量每个文档已被下载的次数每类。我知道我可以通过javascript检测按钮点击,并且就“每个类”部分而言,我可以使用jQuery来检测按钮在哪个类表中点击,但我不明白的是1)如何将这些信息导入到PHP/MySQL代码中记录到数据库中,以及2)我是否只能检测到按钮点击,或者我是否可以检测用户是否实际将文件下载到了他们的计算机(这些是PDF,DOC, XLS文件)。
感谢任何人的帮助!
呃!阿贾克斯!不像我已经在网站的其他部分大量使用它! (我在6个月的停顿后重新认识自己)感谢Moshe(当然还有DaDaDom)! – marky 2011-12-20 15:20:15
很高兴我能帮上忙 – 2011-12-20 15:23:19