javascript - in firefox, image not showing. But in IE, it works -
in ie, code shows 3 images (minimize, restore, close) in right , top of window. in firefox , chrome, fails.
how correct?
thanks.
function panel(_caption,_width,_height,_confirmfunction) { this.icon=new array(); this.icon["minimize"]=env.envpath+'/ui/images/minimize.gif'; ... this.init=function() { this.maindiv=document.createelement("div"); this.maindiv.style.csstext="padding:2px 2px 2px 2px;position:absolute;width:"+_width+"px;left:50%;margin-left:-"+(_width/2)+"px;top:50%;margin-top:-"+(_height/2+50)+"px;border-right:1px solid gray;border-top: 1px solid white;border-left:1px solid white;border-bottom:1px solid gray;background-color:#f2f1ed"; document.body.appendchild(this.maindiv); this.maindiv.handler=this; this.tooldiv=document.createelement("div"); this.tooldiv.style.csstext="background-color:#47649a;height:20px;float:right;margin-left:-3px"; this.maindiv.appendchild(this.tooldiv); var _img=document.createelement("img"); _img.src=this.icon["minimize"]; _img.style.csstext="margin-top:2px;cursor:pointer"; _img.title="minimize"; _img.handler=this; _img.onclick=function(event) { this.handler.minimize(); } this.tooldiv.appendchild(_img); ... } ... }
where/how handle onload event of images ?
should pre-load pictures before using them.
in case helps, there's how handle in simple way preloading :
var toloadcount = 1; // @ least have load window. // same each image want load toloadcount++; var myimage=newimage(); myimage.onload = oneloaded ; myimage.src = ... src... // function oneloaded { toloadcount--; if (!toloadcount) allloaded() } function allloaded() { // here function starts page } window.onload = oneloaded;
Comments
Post a Comment