Jump to content

[SOLVED] Determine an object image source


lilman

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.