Page 1 of 1

check if the image is clicked

Posted: Thu Dec 09, 2010 9:28 pm
by esandra
if this image is clicked:
<img src="images/del.png" width="15" height="15" onclick="hide(<?php echo $y;?>)">

this image should appear:
<img src="images/undo.png" width="20" height="20" onclick="show(<?php echo $y;?>)" title="undo">

2nd image won't replace the first one, it will appear somewhere else

Re: check if the image is clicked

Posted: Fri Dec 10, 2010 1:22 am
by mellowman
this seems to be manageable via JavaScript not php.

Ill give you an example...The bases behind the code is that your updating the div with information and in this case updating it with a button. :D

<script>
function hide() { document.getElementById(div1).innerHTML = '<img src="images/undo.png" width="20" height="20" onclick="show()" title="undo">'; }

function show() { document.getElementById(div1).innerHTML = '<img src="images/del.png" width="15" height="15" onclick="hide()">'; }
</script>
<html>
<div id="div1"><img src="images/del.png" width="15" height="15" onclick="hide()"></div>
</html>

Re: check if the image is clicked

Posted: Sun Dec 12, 2010 7:28 pm
by esandra
thank you for your reply. i'd test this right away