- Jul 13, 2001
- 258
- 0
- 0
I have a webpage with an image on it. The image is dynamically loaded using ASP. In order to preserve the layout of my page, I must make sure that the image width is less than 500 pixels. If it is not, I need to set <img width='500'.
I wrote a small segment of code that checks the image width and resizes it if it is greater than 500. This code is at the end of the page. However, large images that take a long time to load are not resized because they are not finished loading when the code segment is run. Is there any way I can make this work regardless of how long it takes the image to load? I tried the onload event of img tag, but it doesnt seem to work... my syntax could be wrong though.
Any javascript gurus out there have a solution?
I wrote a small segment of code that checks the image width and resizes it if it is greater than 500. This code is at the end of the page. However, large images that take a long time to load are not resized because they are not finished loading when the code segment is run. Is there any way I can make this work regardless of how long it takes the image to load? I tried the onload event of img tag, but it doesnt seem to work... my syntax could be wrong though.
Any javascript gurus out there have a solution?
