加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

解决:swfupload在IE9中不显示上传按钮的问题

发布时间:2020-12-15 18:11:06 所属栏目:百科 来源:网络整理
导读:问题描述: 使用 swfupload.js 上传文件 , 在 IE8 、火狐、谷歌浏览器中显示正常,但是在 IE9 下不能显示上传按钮。 解决方法: 打开 swfupload.js 文件找到 307 行开始的如下代码: // Private: getFlashHTML generates the object tag needed to embed the

问题描述:

使用swfupload.js上传文件,IE8、火狐、谷歌浏览器中显示正常,但是在IE9下不能显示上传按钮。

解决方法:

打开swfupload.js文件找到307行开始的如下代码:

// Private: getFlashHTML generates the object tag needed to embed the flash in to the document

SWFUpload.prototype.getFlashHTML = function (flashVersion) {

??? // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay

??? return ['<object 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="','" />',

??????????????? '<param name="quality" value="high" />',

??????????????? '<param name="allowScriptAccess" value="always" />',

??????????????? '<param name="flashvars" value="' + this.getFlashVars() + '" />',

??????????????? '</object>'].join("");

};

?

?

?

将其替换为:

?

?

// Private: getFlashHTML generates the object tag needed to embed the flash in to the document

SWFUpload.prototype.getFlashHTML = function (flashVersion) {

??? // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay

?

?? ?//处理IE9中不显示上传按钮的情况

??? 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") {

??????? classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';

??? }

??? return ['<object',classid,' id="',

??????????????? '</object>'].join("");

};

注:以上代码在IE7、IE8、IE9、火狐(Firefox 11.0)、谷歌(Google Chrome 17.0.963.83)浏览器中测试运行正常。


原文地址:http://xuzhihong1987.blog.163.com/blog/static/26731587201222611160906/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读