Forum Moderators: open

Message Too Old, No Replies

MM_swapImage function problem

         

cheyy

2:01 am on Jun 30, 2006 (gmt 0)

10+ Year Member



hey i need help with my js code & this function.

<script type="text/javascript">
function showNav(ps_div_name, ps_image_name)
{
if(document.getElementById)
{
if(document.getElementById(ps_div_name))
{
if(document.getElementById(ps_div_name).style.display!= 'block')
{
document.getElementById(ps_div_name).style.display='block';
MM_swapImage(ps_image_name,'','/images/stories/minus_bullet.gif',1);
}
else
{
document.getElementById(ps_div_name).style.display='none';
MM_swapImage(ps_image_name,'','/images/stories/plus_bullet.gif',1);
}
}
}
}
</script>

so that is my script, and this is the link.

<a href="javascript:showNav('news2006','news2006nav');"><img src="http://www.focalscope.com/images/minusbullet.gif" name="news2006nav" border="0"></a>

the 'MM_swapImage' doesn't seem to show. the function is supposed to work as in when the link is clicked, it expands & the image changes. when clicked again, the image changes back to the original image.

texmex

2:42 am on Jun 30, 2006 (gmt 0)

10+ Year Member



I'd suggest your first port of call should be to look into your function MM_swapImage

I also find your logic a tad hard to understand.

IF your DIV is has a style of display:block you hide it before calling MM_swapImage function

If it's not a block, you make it a block before you call the MM_swapImage function, but don't hide it.

All very strange stuff, but then it would be wouldn't it? I haven't a clue what your MM_swapImage function does.

cheyy

3:50 am on Jun 30, 2006 (gmt 0)

10+ Year Member



nevermind it's ok, i've solved the problem. it works perfectly fine. thanks anyway.