$(function () { //初始化绑定默认的属性 $.swfUpLoadDefaults = $.swfUpLoadDefaults || {}; $.swfUpLoadDefaults.property = { single: true, //是否单文件 water: false, //是否加水印 thumbnail: false, //是否生成缩略图 sendurl: null, //发送地址 filetypes: "*.jpg;*.jpge;*.png;*.gif;", //文件类型 filesize: "2048", //文件大小 btntext: "浏览", //上传按钮的文字 btnwidth: 48, //上传按钮的宽度 btnheight: 28, //上传按钮的高度 flashurl: null //FLASH上传控件相对地址 }; //初始化SWFUpload上传控件 $.fn.InitSWFUpload = function (p) { p = $.extend({}, $.swfUpLoadDefaults.property, p || {}); //创建上传按钮 var parentObj = $(this); var parentBtnId = "upload_span_" + Math.floor(Math.random() * 1000 + 1); parentObj.append('<div class="upload-btn"><span id="' + parentBtnId + '"></span></div>'); //初始化属性 var btnAction = SWFUpload.BUTTON_ACTION.SELECT_FILES; //多文件上传 p.sendurl += "?action=UpLoadFile"; if (p.single) { btnAction = SWFUpload.BUTTON_ACTION.SELECT_FILE; //单文件上传 } if (p.water) { p.sendurl += "&IsWater=1"; } if (p.thumbnail) { p.sendurl += "&IsThumbnail=1"; } //初始化上传控件 var swfu = new SWFUpload({ post_params: { "ASPSESSID": "NONE" }, upload_url: p.sendurl, //上传地址 file_size_limit: p.filesize, //文件大小 file_types: p.filetypes, //文件类型 file_types_description: "JPG Images", file_upload_limit: "0", //一次能上传的文件数量 file_queue_error_handler: fileQueueError, file_dialog_complete_handler: fileDialogComplete, upload_progress_handler: uploadProgress, upload_error_handler: uploadError, upload_success_handler: uploadSuccess, upload_complete_handler: uploadComplete, button_placeholder_id: parentBtnId, //指定一个dom元素 button_width: p.btnwidth, //上传按钮的宽度 button_height: p.btnheight, //上传按钮的高度 button_text: '<span class="btnText">' + p.btntext + '</span>', //上传按钮的文字 button_text_style: ".btnText{border:1px;font-family:Microsoft YaHei;font-size:12px;line-height:32px;height:32px;color:#333333;text-align:center;vertical-align:middle; }", //按钮样式 //button_text: "<span class='theFont'>上传</span>", //button_text_style: ".theFont { font-size: 11;font-weight:bold;text-align:center; color:#323d1f;background-color:transparent; }", button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, //背景透明 button_action: btnAction, //单文件或多文件上传 button_cursor: SWFUpload.CURSOR.HAND, //指针手形 flash_url: p.flashurl, //Flash路径 custom_settings: { "upload_target": parentObj, "button_action": btnAction }, debug: false }); } });
自己试着改了属性其他样式也都管用,就上下居中不行