View Single Post
Old 05-05-2008, 06:32 AM   #1 (permalink)
ag3nt42
Contributing Member
 
ag3nt42's Avatar
 
Join Date: 04-22-08
Posts: 99
iTrader: 0 / 0%
Latest Blog:
None

ag3nt42 is liked by many
js function issue

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&nbsp;<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'; } }
ag3nt42 is offline   Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links