Hi there!
I am new to javascript and i need some help in getting my code to work. Essentially you click the links and the image should be displayed in the table cell to the left, however at the moment everytime i click the link it is opening it in a new window. I just can't seem to spot what is going wrong!
Here is the javascript:
And here is where i call the script in the HTML:
Any help at all will be very gratefully received!!!
Thanks
Bantman
I am new to javascript and i need some help in getting my code to work. Essentially you click the links and the image should be displayed in the table cell to the left, however at the moment everytime i click the link it is opening it in a new window. I just can't seem to spot what is going wrong!
Here is the javascript:
Code:
<script type="text/javascript" language="javascript">
function showPic (whichpic) {
if (document.getElementById) {
document.getElementById('placeholder')»
.src = whichpic.href;
if (whichpic.title) {
document.getElementById('desc')»
.childNodes[0].nodeValue = whichpic.title;
} else {
document.getElementById('desc')»
.childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}
return false;
} else {
return true;
}
}
</script>
And here is where i call the script in the HTML:
Code:
<td colspan="2" valign="bottom">
<p id="desc">Choose an image to begin</p>
<img id="placeholder" src="placeholder.gif" alt="" />
</td>
<td colspan="2" valign="bottom">
<a onclick="return showPic(this)" href="books_2.gif" title="A Book!">Book</a>
</td>
Any help at all will be very gratefully received!!!
Thanks
Bantman