Recent posts by Kite
|
Jan 20, 2008
|
Topic: Script development / can't add an img onLoad event handler Hi there, new to javascript. I'm trying to tweak the Craigslist image preview script (http://userscripts.org/scripts/show/6155) to screen out small images. Since the script doesn't know how big the images are until after they load, I'm trying to add an img onLoad event handler with this code: img.onLoad = function () {
This goes in about halfway thru the script, right after: var img = $n("img",newA);
Adding alerts, etc. indicates that the event handler isn't loading at all. Replacing "this" with "img" doesn't work either. Nor does this: function checkSize () {
.
img.onLoad = checkSize; What am I doing wrong? |
