JavaScript Image Loading -
when click on button javascript function invoked , loads image in page. image not loading properly. image size 72kb , image coming db , it's loaded in server start.
if put alert message image loads properly. what's reason behind issue?
var catimg = document.getelementbyid(\"categorysampleimage\"); var oldimgsrc = catimg.src; var newimgsrc = oldimgsrc.substr(0,oldimgsrc.indexof(\"images\"))+\"images/\"+\""+imagename+"\"; catimg.src=newimgsrc; (var intcounter = 1; intcounter <= 500; intcounter++){ (var counter = 1; counter <= 500; counter++) { if(counter==500) break; } } document.getelementbyid(\"light\").style.display=\"block\"; document.getelementbyid(\"fade\").style.display=\"block\";";
code works fine browsers except ie6. in ie6 can see white area in place of image , need right click on theat white area , select “show image”. smaller image in same div displays correctly. don't know how solve issue on ie6.
you can use onload event on image object when loading make sure loaded.
ex.
catimg.onload = function(){ /* image loaded. here*/ }
Comments
Post a Comment