PDA

View Full Version : no image load


blake74
06-30-2002, 11:03 PM
Is there some way to load one image if another doesn't load instead of having the generic browser image placeholder? I saw some javascript that looked promising but didn't work. Does anyone know if this can be done?

boxer_1
06-30-2002, 11:13 PM
Do you mean something like this?:

<img name="myImage" SRC="first.gif" lowsrc="second.gif">

Not 100% sure this is what you are looking for, but figured it was worth mentioning ;).

EDIT: We posted @ almost the same time Dave ;). Well...at least there are a couple of options now :thumbsup: . (Not sure mine is too valid though, I've never had occasion to use lowsrc).

blake74
06-30-2002, 11:35 PM
Thanks for the replies. I'm going to try both options out. I have never seen the "lowsrc" tag before. How exactly is it used and what does it do? I tried it out but the lowsrc never loads regardless of whether there is a first image.

boxer_1
06-30-2002, 11:46 PM
Originally posted by blake74
Thanks for the replies. I'm going to try both options out. I have never seen the "lowsrc" tag before. How exactly is it used and what does it do? I tried it out but the lowsrc never loads regardless of whether there is a first image.

I would take Dave's suggestion. I mis-remembered (I know, not a word) what the lowsrc attribute was used for. How ever it was once used to breech hotmail's security:

http://www.info-sec.com/internet/00/internet_010600a_j.shtml

Not of much relevance to your question.

blake74
07-02-2002, 08:46 PM
The onError code works great with basic html page! However, if I try to use it as output from a cgi script it causes an error in the script and so the script then doesn't work. I'm guessing it might be with the semicolon (;) character, maybe not. Does anyone know how to fix this or make it compatable?

joh6nn
07-02-2002, 09:21 PM
try escaping the semi-colon?

blake74
07-02-2002, 09:38 PM
being fairly new to scripting, what is 'escaping'?

blake74
07-03-2002, 01:30 AM
it worked. thought i tried that but guess not. thanks dave.

Quiet Storm
07-03-2002, 02:34 AM
Anyone know how I can get this idea to work right?:

<img src="pics/test.jp2"
border="0"
onError="document.write('No JPG2000');">

Seems to work, but makes IE continue to do something and takes 2 steps back to get out of the page it's on... :confused:

adios
07-03-2002, 03:17 AM
<html>
<head>
<title>untitled</title>
</head>
<body>
<img src="pics/test.jp2" border="0"
onerror="this.src='http://www.codingforums.com/images/smilies/mad.gif';
document.getElementById('message').innerHTML='No JPG2000'">
<span id="message" style="font:bold 12px arial;color:red;"></span>
</body>
</html>

Quiet Storm
07-03-2002, 03:50 AM
And there it is!

Works perfect! Grasias! ;)

zubamark
07-04-2002, 12:58 AM
I got this code that load pic2.jpg if first one doesn't exists, BUT it doesn't work on the MAC at all.

How to force Mac to recognize onError="this.src='Pic2.jpg'" code?

<img src="Pic1.jpg" onError="this.src='Pic2.jpg'">

blake74
07-04-2002, 06:00 PM
This may be far fetched, but I am no javascript wizard. Just as the onError works with images, is there something that can be set up so that if a specific text word shows up it will be omitted from showing? Such as if the word 'included' keeps showing up from a cgi output. If I don't want users to see this, can it be omitted from showing or even have the text color automatically change to the color of the page background so it blends in?

premshree
07-05-2002, 07:06 PM
Hi.....I have written a script for the same.
Its at http://www.geocities.com/e_i_search/premshree/web-include/pub/scripts/JS/image-error-finder.htm

blake74
07-05-2002, 09:37 PM
Hello premshree..I have a cgi script that is outputting the word "included" from a text file. I don't want the "included" word to show. Is there any way that you know of that will check to see if the word ouputted is "included" and if so no show it or even change the color of it so it'll blend into the background? Like something in the <font> tag or something?

jeorg
07-18-2002, 06:26 PM
<img src="pics/test.jp2" border="0"
onerror="this.src='http://www.codingforums.com/images/smilies/mad.gif';
document.getElementById('message').innerHTML='No JPG2000'">
<span id="message" style="font:bold 12px arial;color:red;"></span>

it works but if I keep only

<img src="test.jpg" border="0"
onerror="this.src=mad.gif'; "/> I get a stack overflow error