开发者

Internet explorer dynamic image loading

开发者 https://www.devze.com 2023-02-15 23:19 出处:网络
I am trying to load images throught javascript. Different browser than IE8 or ie9 it\'s working fine, but in IE doesn\'t. If I load the image directly

I am trying to load images throught javascript. Different browser than IE8 or ie9 it's working fine, but in IE doesn't. If I load the image directly

http://localhost/_eWar/index.php?road=map&createimage=true

it's working fine, but trought javascript

src="index.php?road=map&createimage=true";
 this.img_object.object = $("开发者_如何学JAVA<img>");
this.img_object.object.unbind('load').
                removeAttr("src").
                removeAttr("width").
                removeAttr("height").
                attr("class","map newMap").
                attr("usemap","#world").
                css({ top: 0, left: 0 }).
                load(function(){
                    me.image_loaded = true;
                    me.img_object.display_width = me.img_object.orig_width = this.width;
                    me.img_object.display_height = me.img_object.orig_height = this.height;

                    if(!me.container.hasClass("iviewer_cursor")){
                        me.container.addClass("iviewer_cursor");
                    }

                    if(me.settings.zoom == "fit"){
                        me.fit();
                    }
                    else {
                        me.set_zoom(me.settings.zoom);
                    }

                    if(me.settings.onFinishLoad)
                    {
                       me.settings.onFinishLoad.call(me);
                    }
                //src attribute is after setting load event, or it won't work
            }).attr("src",src);

I get a "compatible view" message.


I'm not sure why you're resetting and looking at attributes on a new image.

Here's an easy way to load images:

function loadSample() {
    var i = new Image()
        i.onload = function() {
             alert("loaded")  
        }
            i.src = "http://jsfiddle.net/img/logo.png"       

} 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号