<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Alternate images, can this be done with plain HTML?' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Alternate images, can this be done with plain HTML?' posted on the 'HTML &amp; WEB-Design' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Fri, 24 May 2013 20:34:56 -0700</pubDate>
    <lastBuildDate>Fri, 24 May 2013 20:34:56 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Alternate images, can this be done with plain HTML?</title>
      <link>http://www.programmersheaven.com/mb/html/52631/52631/alternate-images-can-this-be-done-with-plain-html/</link>
      <description>I'd like a page to display an image(image1.jpg), but it will be on a server that is not always online, so I would like to know if there's a way to make it display another image(image2.jpg) if the first one is not there, kinda like an "Online/Offline" thing...&lt;br /&gt;
The best thing working now is &amp;lt;img src="image1.jpg" alt="Server offline"&amp;gt;... but I want it to show an image, not text...&lt;br /&gt;
&lt;br /&gt;
Does anyone know how to do this?  Even if it's in php or something else I can use it... but I would prefer plain HTML if it's possible.&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/html/52631/52631/alternate-images-can-this-be-done-with-plain-html/</guid>
      <pubDate>Wed, 14 Feb 2001 10:45:41 -0700</pubDate>
      <category>HTML &amp; WEB-Design</category>
    </item>
    <item>
      <title>Re: Alternate images, can this be done with plain HTML?</title>
      <link>http://www.programmersheaven.com/mb/html/52631/52660/re-alternate-images-can-this-be-done-with-plain-html/#52660</link>
      <description>: I'd like a page to display an image(image1.jpg), but it will be on a server that is not always online, so I would like to know if there's a way to make it display another image(image2.jpg) if the first one is not there, kinda like an "Online/Offline" thing...&lt;br /&gt;
: The best thing working now is &amp;lt;img src="image1.jpg" alt="Server offline"&amp;gt;... but I want it to show an image, not text...&lt;br /&gt;
: &lt;br /&gt;
: Does anyone know how to do this?  Even if it's in php or something else I can use it... but I would prefer plain HTML if it's possible.&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
I don't think that it's possible in plain HTML, but I worked something out in php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
if (@fopen('http://myserver/image1.jpg', 'r') == false) {&lt;br /&gt;
	echo "&amp;lt;img src='http://backupserver/image2.jpg'&amp;gt;";&lt;br /&gt;
} else {&lt;br /&gt;
	echo "&amp;lt;img src='http://myserver/image1.jpg'&amp;gt;";&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now that I think about it, it may also be possible with JavaScript, don't know the code yet, but you could try to preload the first image, and if that returns null, preload the second one ... I think something like (this may not be completely syntacticly correct):&lt;br /&gt;
&lt;br /&gt;
myimg = new image()&lt;br /&gt;
myimg.src = 'http://myserver/image1.jpg'&lt;br /&gt;
if (myimg.src = null) {&lt;br /&gt;
myimg.src = 'http://backupserver/image2.jpg'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and then something like&lt;br /&gt;
&amp;lt;img src=myimg.src&amp;gt;&lt;br /&gt;
&lt;br /&gt;
good luck&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/html/52631/52660/re-alternate-images-can-this-be-done-with-plain-html/#52660</guid>
      <pubDate>Wed, 14 Feb 2001 14:09:42 -0700</pubDate>
      <category>HTML &amp; WEB-Design</category>
    </item>
    <item>
      <title>doh, stupid autolinking</title>
      <link>http://www.programmersheaven.com/mb/html/52631/52662/doh-stupid-autolinking/#52662</link>
      <description>&lt;a href="http://myserver/image1.jpg"&gt;http://myserver/image1.jpg&lt;/a&gt; &lt;br /&gt;
should be&lt;br /&gt;
&lt;br /&gt;
h t t p : / / m y s e r v e r / i m a g e 1 . j p g&lt;br /&gt;
&lt;br /&gt;
without the spaces &lt;img src="http://www.programmersheaven.com/images/Community/grin.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/html/52631/52662/doh-stupid-autolinking/#52662</guid>
      <pubDate>Wed, 14 Feb 2001 14:13:05 -0700</pubDate>
      <category>HTML &amp; WEB-Design</category>
    </item>
  </channel>
</rss>