<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="js/themes/base/jquery.ui.all.css" rel="stylesheet" />
<link href="js/jquery.jdownload.css" rel="stylesheet" />
</head>
<body>
<a title="title" id="download">点击预览下载</a>
<script src="js/jquery-1.9.1.js"></script>
<script src="js/ui/jquery-ui.js"></script>
<script src="js/jquery.jdownload.js"></script>
<script>
$(document).ready(function () {
$(‘#download‘).jDownload({
event: ‘click‘,
dialogWidth: 200,
dialogHeight: 200,
filePath: "/file/test.zip"
});
});
</script>
</body>
</html
引用jquery和ui库,引用jquery.jdownload.js和样式。
参数说明
var config = {
root: "http://localhost:8080/",//你网站的地址。
filePath : null,
event : "click", // 默认是支持点击事件
dialogTitle : "文件下载",
dialogDesc : ‘点击下载‘,
dialogWidth : 200,
dialogHeight : ‘auto‘,
dialogModal : true,
showfileInfo : true,
start : null,
stop : null,
download : null,
cancel : null
}