Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Trapping "File not Found"


  • From: javascript@xxxxxxxxxx (Hassan Schroeder)
  • Subject: [Javascript] Trapping "File not Found"
  • Date: Wed, 24 Jul 2002 10:18:23 -0700

"Stern,Matthew" wrote:

> I'm using JavaScript to create an HTML page that is the startup screen for installation. The
> challenge is that the programs that can be launched from this screen might be on two CDs. I'd like
> to find a way to trap the "File not Found" error and show an alert that instructs the user
> to insert the correct CD. 

You can have a different test image on each CD and use the Error 
event -- quick sample:

<script type="text/javascript">
function woops()
{
	document.open();
	document.write('<h1 style="color: red;">Dude, insert the other CD!</h1>');
	document.close();
}
</script>

<img src="otherCDImage.gif" height="100" width="100" onerror="woops();">

If 'otherCDImage' fails to load because it's only on the CD that's
not mounted, woops() will run ...

HTH!
-- 
H*
Hassan Schroeder ----------------------------- hassan@xxxxxxxxxxxxxx 
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --