Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript image thumbnail change on click link NOT WORKING.. Anyone. 1

Status
Not open for further replies.

flyclassic22

Technical User
Oct 1, 2002
54
SG
hello, anyone can help me solve this problem??
my javascript is not working.... can't change the image when i click on the 1,2,3,4,5

See at the top right photo preview..

However, if i right click "show picture" , it can show the picture out, however if i click on the link, its not working.. can anyone let me know what problem is it? I can't figure out.

here's the script(can be view directly from my web)

<SCRIPT LANGUAGE="JavaScript1.1">

function change_image(imageurl) {
var imgName = " +imageurl
//document.write(imgName);
document.myimage.src = imgName

}
</SCRIPT>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><img src=" width="180" height="135" name="myimage"></td>
</tr>

<tr>
<td align="center"><span class="style1"><a href="javascript:;" onClick="change_image('meNfeismall.gif')"> 1 </a> | <a href="javascript:;" onClick="change_image('pqsjme.gif')"> 2 </a> | <a href="javascript:;" onClick="change_image('alvinme.gif')"> 3 </a> |
<a href="javascript:;" onClick="change_image('family.gif')"> 4 </a> | <a href="javascript:;" onClick="change_image('meandsis.gif')"> 5 </a> | <a href="javascript:;" onClick="change_image('mepolyfriends2.jpg')"> 6 </a> | <a href="javascript:;" onClick="change_image('mepolyfriends3.jpg')"> 7 </a> | <a href="javascript:;" onClick="change_image('young.jpg')"> 8 </a> | <a href="javascript:;" onClick="change_image('guitaristWilson.gif')"> 9 </a> | <a href="javascript:;" onClick="change_image('myCar.jpg')"> 10 </a> | <a href="javascript:;" onClick="change_image('ibanezrg450Ltd.gif')"> 11 </a></span></td>
</tr>
</table>
</div>
<div align="left"></div>
</div>
<!--end of profile layer-->
</td>
</tr>
</table>
 

If you change all occurrences of:

Code:
<a href="javascript:;" onClick="change_image(

to:

Code:
<a href="javascript:change_image(

then all works as expected.

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top