I am currently working on a website, using a fairly straight-forward script, however I am looking for someone who can modify the script to my needs.
What I need, is a method for any image which doesn't actually 'exist' would not appear as an option.
So, looking at the example below, it would display options 1, 2, 3, however if image 2 were not at the source location, it would not even display the option for 2.
What I need, is a method for any image which doesn't actually 'exist' would not appear as an option.
So, looking at the example below, it would display options 1, 2, 3, however if image 2 were not at the source location, it would not even display the option for 2.
HTML:
<select size="6" id="reportlist" class="custom-select">
<option value="">Select Option</option>
<option value="01.jpg">1</option>
<option value="02.jpg">2</option>
<option value="03.jpg">3</option>
</select>
<script>
function displayReports() {
var img = document.getElementById("image");
img.src = this.value;
return false;
}
document.getElementById("reportlist").onchange = displayReports;
</script>