I'm trying to write a js function to complete two tasks with one event.
basically an onclick that checks to see if an img src is a specific pic then run actions based on that..below is my code which should give you an understanding of what i'm trying to accomplish... my problem i'm having is that the function will work the first time.. but not on the second click.
I would appreciate any advice somone can give.. ty
HTML
Code:
<div id='Alinkz'>
<div id='TCbox2'></div>
<div id='AlinkzDiv' style='height:15px;overflow:hidden;' onclick='switchArrows1();'>
EDIT MENU LINKS <img id='collapser1' src='imgs/arrowsdown.png' /><hr width='400px' />
<?php require('forms/Lkzform.php');?>
</div>
<div id='BCbox2'></div>
</div>
JS
Code:
function switchArrows1()
{
if(document.getElementById("collapser1").src='imgs/arrowsdown.png')
{
document.getElementById("collapser1").src='imgs/arrowsup.png';
document.getElementById("AlinkzDiv").style.height="100%";
}
else if(document.getElementById("collapser1").src='imgs/arrowsup.png')
{
document.getElementById("collapser1").src='imgs/arrowsdown.png';
document.getElementById("AlinkzDiv").style.height="15px";
}
else
{
document.getElementById("collapser1").src='imgs/arrowsdown.png';
}
}