[Javascript] Trapping "File not Found"
Hassan Schroeder
hassan at webtuitive.com
Wed Jul 24 12:18:23 CDT 2002
"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 at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
-- creating dynamic Web sites and applications since 1994 --
More information about the Javascript
mailing list