我打电话的时候 " $("#progressbar")。progressbar({"计算机告诉我"进度条不是功能" 此外,进度条甚至不会显示在屏幕上 在asp中使用visual studio 2015 prograo。 net framework 4.5
<script src="jquery-ui.js"></script>
<script src="jquery-2.1.4.js"></script>
<link href="jquery-ui.css" rel="stylesheet" />
<script >
$(document).ready(function () {
$("#Button1").click(function (evt) {
var xhr = new XMLHttpRequest();
var data = new FormData();
var files = $("#FileUpload1").get(0).files;
for (var i = 0; i < files.length; i++) {
data.append(files[i].name, files[i]);
}
xhr.upload.addEventListener("progress", function (evt) {
if (evt.lengthComputable) {
var progress = Math.round(evt.loaded * 100 / evt.total);
$("#progressbar").progressbar("value", progress);
}
}, false);
xhr.open("POST", "UploadHandler.ashx");
xhr.send(data);
$("#progressbar").progressbar({
max: 100,
change: function (evt, ui) {
$("#progresslabel").text($("#progressbar").progressbar("value") + "%");
},
complete: function (evt, ui) {
$("#progresslabel").text("File upload successful!");
}
});
evt.preventDefault();
});
});
</script>
体
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Select File(s) to Upload :"></asp:Label>
<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Upload" />
<br />
<br />
<div id="progressbar" class="progressbar">
<div id="progresslabel" class="progressbarlabel">zzz</div>
</div>
</form>
答案 0 :(得分:0)
尝试更改
<script src="jquery-ui.js"></script>
<script src="jquery-2.1.4.js"></script>
到
<script src="jquery-2.1.4.js"></script>
<script src="jquery-ui.js"></script>