我从this site导入了此插件的js文件,如下所示
<script type="text/javascript" src="/gestionRH/js/jquery/jqueryFileDownload.js"></script>然后

$.fileDownload('mypath');


Firebug向我显示此错误:TypeError: $.fileDownload is not a function

chrome显示了这一点:未捕获的TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'fileDownload'

这整个代码

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>

     <script type="text/javascript"  src="/gestionRH/js/jquery/jquery13_min.js"></script>


    </head>
    <body>
    <input type="button" id="download" value="download">

    </body>
    <script type="text/javascript">
    $("#download").live("click",function(){
     $.fileDownload('C:\\Users\\free\\Desktop\\myworkspace\\gestionRH\\WebRoot\\fiches\\note.doc');
    });
    </script>
    </html>

最佳答案

对于那些将面临相同问题的人,问题是由于此:路径不正确,我必须从服务器下载,因此路径为

 $.fileDownload('http://localhost:8080/path/to/file');


不是$.fileDownload('C:\\Users\path\to\file');

09-11 14:12