在系統測試過程中發現使用了SwfUpload實現的無刷新上傳功能在IE上竟然無法使用了難道SwfUpload不支持嗎?還是需要換一種實現方式呢?最後通過了解SwfUpladJS文件發現我們是可以修改的讓其支持IE具體解決方案如下
打 開SwfUploadjs在js文件中找到// Private: getFlashHTML generates the object tag needed to embed the flash in to the document”這行和“// Private: getFlashVars builds the parameter string that will be passed”和這行然後把中間的用如下代碼替換就OK了
復制代碼 代碼如下:
SWFUpload
prototype
getFlashHTML = function (flashVersion) {
// Flash Satay object syntax:
var classid = "";
var Sys = {};
var ua = navigator
userAgent
toLowerCase();
if (window
ActiveXObject) {
Sys
ie = ua
match(/msie ([d
]+)/)[
];
if (Sys
ie && Sys
ie
substring(
) == "
" || Sys
ie
substring(
) == "
") {
classid =
classid = "clsid:d
cdb
e
ae
d
cf
b
"
;
}
}
return [
<object
classid
id="
this
movieName
" type="application/x
shockwave
flash" data="
(this
support
imageResize ? this
settings
flash_url : 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
support
imageResize ? this
settings
flash_url : this
settings
flash
_url)
" />
<param name="quality" value="high" />
<param name="allowScriptAccess" value="always" />
<param name="flashvars" value="
+ this
getFlashVars() +
" />
</object>
]
join("");
};
保存運行就可以看到效果了完美!
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20171.html