RiyazAhmed RiyazAhmed - 1 year ago 90
HTML Question

how to change td background color after click

hello guys please help me to solve out thanks in advance
i want to display message or any kind of notification to the user like change green background color after click or message like "you click successfully"

my website image screenshot

enter image description here

here is my code

<a href="out.php?id=<?php echo $id;?>" onclick="myFunction()" target="_blank" onfocus="curTab">
<img src="admin/uploads/<?php echo $res['image']; ?>" id="click"style="width:200px;height:75px;" />

Answer Source

@Ron answer is right. And if you want to use the onclick attribute like you do (it is not used in Ron's answer), you'd do:

In the html: onclick=myFunction(this)

In the js:

function myFunction(elt) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download