lilman Posted April 29, 2007 Share Posted April 29, 2007 I am trying to determine an object image source, so I know which image to display when ‘onclick’. Here is my JavaScript code: function togglePhoto(objectPhoto) { var object = document.getElementById(objectPhoto); state = object.document.images.src; if (state == 'Contro1.gif') object.document.images.src = 'Contro2.gif'; else if (state != 'Contro1') object.document.images.src = 'Contro1.gif'; } Here is where I call the function: <tr> <td width="8%"><img border="0" src="Contro1.gif" width="47" height="35" id="mystatspic"></td> <td width="92%"> <p align="left"><b><a onclick="toggleDisplay('mystats'); togglePhoto('mystatspic')" href="javascript:void('')"> <font face="Arial" color="#FFFFFF" size="2">My Stats</font></a></b> </td> </tr> Link to comment https://forums.phpfreaks.com/topic/49219-solved-determine-an-object-image-source/ Share on other sites More sharing options...
fenway Posted April 30, 2007 Share Posted April 30, 2007 "Object" is reserved... but what else doesn't work? Link to comment https://forums.phpfreaks.com/topic/49219-solved-determine-an-object-image-source/#findComment-241786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.