4 images lined up together;
when user clicks on the image it inserts a value in to a hidden field to send to mysql server (using onclick);
Using JS to change a preview image when image is clicked;
Now what i want to do is scrap the preview (image that changes on image click) and place a border around the image that is clicked on… not only that but i need to remove the border if another image is clicked.
Here is my JS code and html code
My Java script
<script language="javascript" type="text/javascript">
function SetImageName(strName)
{
//change the input field name to the name of image we want to use
document.getElementById("ImageName").value = strName;
//Change preview image when clicked
document.getElementById("imageid").src= "includes/img/memory/" + strName + ".gif";
}
</script>
and the html i am using
<!-- ALLOW USER TO SELECT IMAGE-->
Select your image<br /><br />
<img src="includes/img/memory/memory1.gif" name="memory1" class="memoryselectimg" onclick="SetImageName(this.name)"/>
<img src="includes/img/memory/memory2.gif" name="memory2" class="memoryselectimg" onclick="SetImageName(this.name)"/>
<img src="includes/img/memory/memory3.gif" name="memory3" class="memoryselectimg" onclick="SetImageName(this.name)"/>
<img src="includes/img/memory/memory4.gif" name="memory4" class="memoryselectimg" onclick="SetImageName(this.name)"/>
<input type="hidden" value="memory1" id="ImageName" name="ImageName">
<!-- preview image from when user clicks -->
<img src="includes/img/memory/memory1.gif" id="imageid" name="imageid" class="memoryselectimg" />
Anyone got a starting point for me?
Much Appriciated!