August 27th, 2004, 06:47 PM
Wondering if this is possible. I've seen a couple of topics on this forum relating to a similar process checking for website URLs, I just thought this might be different enough to warrant a new approach.
Here's my code:
document.getElementById('imag').src=x.myOptions.value + x.myInput.value
Search for Images ::
<select name="myInput" size="1">
<option selected value="blank">-- Movie Index --</option>
<option value="_Mov_1.JPG">First Movie
<option value="_Mov_2.JPG">Second Movie
<option value="_Mov_3.JPG">Third Movie
<option value="_Mov_4.JPG">Fourth Movie
<select name="myOptions" size="1" onchange="validate()">
<option selected value="blank">-- Scene Index --</option>
<option value="Scene_One">Scene One
<option value="Scene_Two">Scene Two
<option value="Scene_Three">Scene Three
<option value="Scene_Four">Scene Four
<option value="Scene_Five">Scene Five
<option value="Scene_Six">Scene Six
<option value="Scene_Seven">Scene Seven
<img id="imag" src="splash.JPG">
What I want to do is check and see if there is actually an image called, for example, "Scene_One_Mov_1", and if there isn't redirect the user to an error message. Would probably be written in an "if ... else" statement.
Thank you for your time
August 27th, 2004, 06:52 PM
Hmm... sorry, not about to go through all that mess. Here's one way to get it done:
If you were to use a form to gather the urls to check, and then use a function to change the url of a 1x1 pixel image. If there was a problem, the onerror event would be triggered, and you can execute whatever code you want.
<img src='invalid_url.png' onerror="alert('image does not exist/you are not connected to the internet');"
Last edited by obi_wonton; August 27th, 2004 at 06:54 PM.
May the source be with you - obi_wonton
August 27th, 2004, 08:10 PM
Originally Posted by obi_wonton
Perfect fit! Thank you.