Hi guys, I have a problem about displaying some IMGs in my asp code: JavaScript: function chkTmbSize(id) { var h = id.height; var w = id.width; id.resize = true; if (h>w) { id.width = 30 / id.height * id.width; id.height = 30; } else { id.height = 40 / id.width * id.height; id.width = 40; } } Codes: <% Response.Buffer = True %> ..... <IMG ID="thumb" SRC="<%=tImg%>" Onload="chkTmbSize(this);"> the code works without error but just SOMETIMES it display the IMG in 0,0 width/height in a FOR/NEXT loop, but after refresh the page, the IMG will be showed correctly. Could you please help to solve this problem, and sorry for my poor English, thanks in advance.
instead of putting the onload per <img onload event, put a loop in javascript in the head of the document. Then put an onload event handler in the body tag. This can run through all items that you wrote with your asp code... So essentially, write the list of your images in the javascript function to check for, then you only need one js function call