hello all,
i am trying to make a very simple show/hide menu where some content is shown or hidden by clicking. i've got the show/hide piece to work, but i cannot get the image to swap from plus to minus when the user clicks on the plus image to expand the menu.
here is my javascript code:
<script type="text/javascript">
<!--
var counter=0;
var plusminus
function hide(el)
{
if(counter==0)
{
document.getElementById(el).style.display="block";
counter=1;
plusminus="minus";
}
else
{
document.getElementById(el).style.display="none";
counter=0;
plusminus="plus";
}
}
//-->
</script>
here is the html that calls it:
<a href="#" onClick="javascript: hide('menu1')"><script type="text/javascript">document.write('<img src="images/'+plusminus+'.jpg" id="plus" border="0">')</script>
i am not that familiar with javascript (just a beginner at the moment!). any help will be greatly appreciated!!
thanks so much in advance!!
karren
i am trying to make a very simple show/hide menu where some content is shown or hidden by clicking. i've got the show/hide piece to work, but i cannot get the image to swap from plus to minus when the user clicks on the plus image to expand the menu.
here is my javascript code:
<script type="text/javascript">
<!--
var counter=0;
var plusminus
function hide(el)
{
if(counter==0)
{
document.getElementById(el).style.display="block";
counter=1;
plusminus="minus";
}
else
{
document.getElementById(el).style.display="none";
counter=0;
plusminus="plus";
}
}
//-->
</script>
here is the html that calls it:
<a href="#" onClick="javascript: hide('menu1')"><script type="text/javascript">document.write('<img src="images/'+plusminus+'.jpg" id="plus" border="0">')</script>
i am not that familiar with javascript (just a beginner at the moment!). any help will be greatly appreciated!!
thanks so much in advance!!
karren