简体   繁体   中英

Set focus on img src

I have something like a comment box and I have a delete button like this for every comment.

When i click on the img to delete my comment it works well, but focuses on the TOP of the page.

Can I somehow focus it on the comment that I am about to delete, or can I only focus on the top or bottom of the page? I'm not sure if this is confusing...

  <a href="#" onclick="deletedata('<?php echo $row['CommentID'];?>')" 
     style="color:#FF0000; float:right;margin-right:20px;">
            <img src="images/trash.png" style="background:#FFFFFF" />
  </a>

return false添加到Javascript语句的末尾以防止跟踪href:

onclick="deletedata('<?php echo $row['CommentID'];?>'); return false;"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM