I'm making a calendar of events, and the "details" for the event are on a hidden div.
I have a small icon that, when clicked, uses javascript to show the details.
What I want is that when this is clicked, the icon is replaced by a different icon (to show it is 'open') and for that icon, when clicked, to close the div again.
So the current code is
<a href="#" onclick="Effect.BlindDown('eventdetails<?php echo $event_count;?>'); return false;"><img class="open" src="./img/plus.png"></a>
And I'd want the image to change to "minus.png". So then it would be
<a href="#" onclick="Effect.BlindUp('eventdetails<?php echo $event_count;?>'); return false;"><img class="open" src="./img/minus.png"></a>
But cant quite figure it out. Any ideas?
UPDATE
OKay, currently have from Mia, but still not working
<a href="#" onclick="toggleDisplayWait("eventdetails<?php echo $event_count;?>", "icon", 800); return false;"><img id="icon" class="open" src="./img/plus.png"></a>
And in the header...
function toggleDisplayWait(divId, imgId, durationmSec) {
if(!$(divId).visible()) {
move = Effect.BlindDown;
newImage = "./img/minus.png";
}
else {
move = Effect.BlindUp;
newImage = "./img/plus.png";
}
move(divId, {duration: durationmSec / 1000.0 });
setTimeout(function() { $(imgId).src = newImage; }, durationmSec)
}
$(divId).hide();
</script>
When I run the event, I get a syntax error on toggledisplaywait (
No comments:
Post a Comment