You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Leticia Golubov <lg...@micromuse.com> on 2004/04/29 16:42:58 UTC

Swap Image

I originally had a function on a jsp page, which worked fine, until I
started using the <html:image> tag.  Has anyone encoutered this problem?
Anyone has a solution or an idea as to why this doesn't work anymore?


function SwapImage( img_name, img_src )
{
	document[img_name].src = img_src;
}

..............

<html:image page="/images/button_toolbar_debug_start.png" border="0"
alt="Start" title="Start"
	   onclick="do something"

onmouseover="SwapImage('Start','/precision/images/button_toolbar_debug_start
_over.png'); SetStatus('Start'); return true;"

onmouseout="SwapImage('Start','../../images/button_toolbar_debug_start.png')
; SetStatus(''); return true;"

onmousedown="SwapImage('Start','./../images/button_toolbar_debug_start_click
.png');"

onmouseup="SwapImage('Start','../../images/button_toolbar_debug_start_over.p
ng');" />

(Note that /precision/image is the context path, and I've tried different
combinations - originally the relative path ../../ did work)

The "do something" action triggered by onclick does work...  and using src
instead of page does not make any difference...

This was the original code which allowed SwapImage to work fine:

<td><a onClick="do something"

onMouseOver="SwapImage('stop','../../images/button_toolbar_debug_stop_over.p
ng'); SetStatus('Stop Discovery'); return true;"
	onMouseOut="SwapImage('stop','../../images/button_toolbar_debug_stop.png');
SetStatus(''); return true;"

onMouseDown="SwapImage('stop','../../images/button_toolbar_debug_stop_click.
png');"

onMouseUp="SwapImage('stop','../../images/button_toolbar_debug_stop_over.png
');">
	<img name="stop" src="../../images/button_toolbar_debug_stop.png"
border="0" width="26" height="26" alt="Stop"></a>
</td>

Maybe I'm not getting the difference between the two and they are actually
completely different?  If so I'd appreciate some help understanding... :)

regards

Leticia


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org