I'm setting up a script to do some basic checks on a whole bunch of pages (looking for script errors, 'undefined' appearing on the page, etc) and I would also like to have it look for broken images. Is there any way to do this in a generalized way? I won't be able to create different code for each individual page.

Any help would be appreciated!