Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can you check for broken links?

    I want to run some code if there is an image that isn't showing. how do i check for the condition if whatever.src=[not existing/null or whatever]?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,032
    Thanks
    0
    Thanked 248 Times in 245 Posts
    var img = new Image();
    img.onerror = function(){alert("error in loading!")};
    img.onloaded = function(){alert("loaded successfully!")};
    img.src = "blah.gif";


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •