08-09-2009, 03:00 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jul 2009
Posts: 80
Thanks: 13
|
Update Text if div is showing or hiding
Hi i found this code however it is not updating the text correctly on my computer.
javascript Code:
<script type="text/javascript">
function ShowHide(elementId) { var element = document.getElementById(elementId); if(element.style.display != "block") { element.style.display = "block"; } else { element.style.display = "none"; } } function UpdateText(element) { if(element.innerHTML.indexOf("Show") = -1) { element.innerHTML = "show<img src='images/YOUR THEME /fastreply.gif'>"; } else { element.innerHTML = "hide<img src='images/YOUR THEME/fastreply.gif'>"; } } </script>
php Code:
<?phpprint '<a href="javascript:void(0);" onclick="ShowHide(\'search'. $row[ 'id']. '\');UpdateText(this);">'; ?>
If anyone can help that would be alsome, I thought it was the UpdateText because I have more then one of these on the same page since it prints it 10 times.
But after 5 hours working at it, can't get it to work...
please help if you can
Last edited by russellharrower : 08-09-2009 at 04:26 PM.
|
|
|
|