DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> SwfUpload在IE10上不出現上傳按鈕的解決方法
SwfUpload在IE10上不出現上傳按鈕的解決方法
編輯:關於JavaScript     
在系統測試過程中,發現使用了SwfUpload實現的無刷新上傳功能,在IE10上竟然無法使用了,難道SwfUpload不支持嗎?還是需要換一種實現方式呢?最後通過了解SwfUplad.JS文件發現,我們是可以修改的,讓其支持IE10,具體解決方案如下:

打開SwfUpload.js,在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: http://www.alistapart.com/articles/flashsatay
var classid = "";
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject) {
Sys.ie = ua.match(/msie ([\d.]+)/)[1];
if (Sys.ie && Sys.ie.substring(0, 1) == "9" || Sys.ie.substring(0, 2) == "10") {
classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
}
}
return ['<object', classid, ' id="', this.movieName, '" type="application/x-shockwave-flash" data="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_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.flash9_url), '" />',
'<param name="quality" value="high" />',
'<param name="allowScriptAccess" value="always" />',
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
'</object>'].join("");
};

保存,運行就可以看到效果了,完美!
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved