Have an account? / Register

Forgot your password?

Forgot your username?

Results 1 to 5 of 5

Thread: Is there a Css Solution to broken Images

  1. #1
    thin[box]king
    Join Date
    Aug 2003
    Location
    Cambridge
    Posts
    1,905
    Thanks
    13
    Thanked 12 Times in 12 Posts

    Is there a Css Solution to broken Images



    Is there a CSS 'trick' to change the default 'image link broken' red cross to a specified jpg/gif file?

    Cheers
    Follow Me | Looking for Merchants Who Do Scifi Stuff

  2. #2
    memoryfinder.co.uk
    Join Date
    Jun 2005
    Location
    Wiltshire, UK
    Posts
    343
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think you'd be able to do this with CSS, there might be a way to do it with JavaScript but depending on how many images there are on any one page, it might slow down the page rendering.
    Kris

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    2,448
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's not a way that I know of via CSS but using javascript you can put this into the header of the page
    Code:
    <script>
    function imgerr(img) {
       img.src='errorimage.gif';
    }
    </script>
    then add onError='imgerr(this);' into any image tags. Then any images that fail to load will be replaced by errorimage.gif - just make sure that image does exist!

  4. #4
    Dark Prince lowndsy's Avatar
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,934
    Thanks
    13
    Thanked 83 Times in 60 Posts
    set the image as a background URL with css - thn if it doesn't appear it'll just be blank. Or set an error image as the lo-res alternative image.

  5. #5
    thin[box]king
    Join Date
    Aug 2003
    Location
    Cambridge
    Posts
    1,905
    Thanks
    13
    Thanked 12 Times in 12 Posts
    Quote Originally Posted by Rich
    There's not a way that I know of via CSS but using javascript you can put this into the header of the page
    Code:
    <script>
    function imgerr(img) {
       img.src='errorimage.gif';
    }
    </script>
    then add onError='imgerr(this);' into any image tags. Then any images that fail to load will be replaced by errorimage.gif - just make sure that image does exist!
    Cheers Rich will probably go with this - I was just hoping that there would be a was f specifying another image than the little red cross - if only things were that simple.

    Thanks to the other posters - some good ideas
    Follow Me | Looking for Merchants Who Do Scifi Stuff

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Shop Window Content Units - broken images...
    By Azam.net in forum Affiliate Window
    Replies: 10
    Last Post: 20-07-05, 05:17 PM
  2. Broken Images (PHP)
    By goforbroke in forum Programming
    Replies: 4
    Last Post: 21-04-05, 02:35 PM
  3. Broken Images on my site..
    By frazer987 in forum Affiliate Marketing Lounge
    Replies: 1
    Last Post: 30-03-05, 07:32 PM
  4. Awin XML stuff , broken images.
    By Aquanuke in forum Affiliate Window
    Replies: 8
    Last Post: 23-04-03, 07:15 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO 3.6.1