<script type="text/javascript">
// simple image viewer: her.bird@gmail.com
// INSERT YOUR IMAGE URLS HERE
imgList = new Array(
"img1.gif","img2.jpg","img3.bmp"
);
// THE MAIN FUNCTION, NEEDS NO CHANGES
function changeImage(){
imgFetch = document.canvasForm.canvasSelect.value;
if(imgFetch == ""){
false;
}else{
document.write("<div><img border='0' src='"+imgFetch+"' /></div>");
document.write("go back");
}
}
// THIS IS THE SELECT FORM
document.write("<form name='canvasForm'>");
document.write("<select name='canvasSelect' size='1' onchange='changeImage()'>");
document.write("<option value=''>select image...</option>");
for(imgC=0;imgC<imgList.length;imgC++){
document.write("<option value='"+imgList[imgC]+"'>"+imgList[imgC]+"</option>");
}
document.write("</select>");
document.write("</form>");
document.write("<div id='theCanvas'></div>");
</script>
1) First you have an array that keeps all of your image URLs.
2) Then the function that loads up the value from the select box.
3) And writes the <img> tag with the loaded image value (URL).














Comments
Fantastic work mate.
Can I ask you a question about scripting?
I'm kind of new and I need to make one of those modules you click and the writing appears and disappears.
The problem is, there isn't a tutorial anywhere on the web and I need it pronto :S
Please could you perhaps make the script for one of these?
thanks
detendez
--
[link]
where do i go for that?
--
[link]
--
[link]
if i experience any difficulties...please could i ask?
--
[link]
Previous PageNext Page