<%@ page language="c#" contenttype="text/html" responseencoding="gb2312" %>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/网页特效">
(function($) {$.fn.multiupload = function(options) {
var multiupload = this;
options = $.extend({
fileselector: ".file-upload",
deleteselector: ".delete-file"
}, options || {});var filenamedatakey = "targetfilename";
var addoperate = function(target) {
var warp = $("<div></div>");
multiupload.append(warp);warp.append(target);
target = $(target);var deletebutton = $("<a></a>");
warp.prev().append(deletebutton);
deletebutton.text("剔除");
deletebutton.attr("href", "javascript:void(0);");
deletebutton.data(filenamedatakey, target.attr("name"));
deletebutton.addclass(options.deleteselector.substring(1));
};var filecount = function() {
return multiupload.find(options.fileselector).size();
};var emptyfilecount = function() {
return multiupload.find(options.fileselector).filter(function() {
return !$(this).val();
}).size();
};var templete = multiupload.find(options.fileselector + ":first");
// addoperate(templete);
var div = $("<div></div>");
div.append(templete);
multiupload.append(div);
//alert(multiupload.html());var basename = templete.attr("name");
var count = 1;
this.find(options.fileselector).change(function() {
var self = $(this);if (self.val() && emptyfilecount() === 0) {
var newfile = self.clone(true);self.parent().append(newfile);
newfile.val(null);
newfile.attr("name", basename + ++count);addoperate(newfile);
}});
this.find(options.deleteselector).live("click", function() {
var self = $(this);
self.parent().remove();
// var filename = self.data(filenamedatakey);
// var file = multiupload.find("input[name=" + filename + "]");// if (filecount() === 1) {
// file.val(null);
// } else {
// file.parent().remove();
// }});
};
})(jquery);
</script>
首页 1 2 3 末页