GSimpson
05-19-2009, 07:22 AM
<script language="javascript" type="text/javascript">
function previewimage(imagename) {
document.getElementById("preview-image").src="uploads/previews/" . imagename;
}
</script>
Hi there. I have this piece of coding sitting in the head coding of my website. I'm unsure of any syntax errors in it, but I do know that it's not working when called upon like this:
<div id="recent-rotator">
<div id="selection">
<a href="entry/?id=2" onmouseover="previewimage(2.png)">Two</a>
<a href="entry/?id=1" onmouseover="previewimage(1.png)">One</a>
</div>
<div id="selected"><img id="preview-image" src="uploads/previews/2.png" alt="Two"/></div>
</div>
I honestly, cannot figure out what's wrong with it. I bet that it's something simple. I've checked directories etc and they are fine, but I can't work out why it won't change image upon mouse over. I don't use Javascript a lot so any help would be nice.
Thank you :)
function previewimage(imagename) {
document.getElementById("preview-image").src="uploads/previews/" . imagename;
}
</script>
Hi there. I have this piece of coding sitting in the head coding of my website. I'm unsure of any syntax errors in it, but I do know that it's not working when called upon like this:
<div id="recent-rotator">
<div id="selection">
<a href="entry/?id=2" onmouseover="previewimage(2.png)">Two</a>
<a href="entry/?id=1" onmouseover="previewimage(1.png)">One</a>
</div>
<div id="selected"><img id="preview-image" src="uploads/previews/2.png" alt="Two"/></div>
</div>
I honestly, cannot figure out what's wrong with it. I bet that it's something simple. I've checked directories etc and they are fine, but I can't work out why it won't change image upon mouse over. I don't use Javascript a lot so any help would be nice.
Thank you :)