123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- var pic = [];
- var upload = [];
- function loadUpload(i,e,key,upload,assets)
- {
- var value = e.attr('v');
- if(typeof(upload[value]) != "undefined")
- {
- return;
- }
- upload[value] = true;
- e.uploadify({
- 'formData' : {'key' : key},
- 'swf' : assets + 'uploadify.swf',
- 'buttonText' : '选择文件',
- 'uploader' : upload,
- 'cancelImg' : assets + 'upload/img/fyuploadify-cancel.png',
- 'onUploadSuccess':function(file,data,response)
- {
- //console.info(data);
- var data = eval('('+data+')');
- if(data.status)
- {
- var mul = e.attr('mul');
- if(mul == 'yes')
- {
- if(pic.length <= 0 && $("#" + value).val())
- {
- pic = $("#" + value).val().split(',');
- }
- var m = $('.' +value+'_mul');
- var i = m.find('img').eq(pic.length);
- if(i.length)
- {
- i.attr('src', data.url);
- }
- else
- {
- m.append('<a href="javascript:;" title="点此删除" onclick="picDel(\''+data.url+'\', $(this), \''+value+'\')"><img src="'+data.url+'" width="150" style="margin-left:5px;" alt="点此删除"/></a>');
- }
-
-
- pic.push(data.url);
- //console.info(pic);
- $("#" + value).val(pic.join(','));
- }
- else
- {
- $("#"+file.id).find('.data').html('上传完毕');
- $('#'+value).val(data.url);
- $('#show_'+value).attr('src',data.url).show();
- }
- }
- else
- {
- $("#"+file.id).find('.data').html("<font color='red'>"+data.message+"</font>");
- return false;
- }
- }
- });
- }
- if(jQuery.browser.msie){
- SWFUpload.prototype.getFlashHTML = function () {
- return ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
- '<param name="wmode" value="', this.settings.button_window_mode , '" />',
- '<param name="movie" value="', this.settings.flash_url, '" />',
- '<param name="quality" value="high" />',
- '<param name="menu" value="false" />',
- '<param name="allowScriptAccess" value="always" />',
- '<param name="flashvars" value="' + this.getFlashVars() + '" />',
- '</object>'].join("");
- }
- }
- function picDel(p,e,v)
- {
- if(pic.length <= 0 && $("#" + v).val())
- {
- pic = $("#" + v).val().split(',');
- }
-
- e.remove();
- pic.remove(p);
- //console.info(pic);
- $("#" + v).val(pic.join(','));
- }
|