PHP Echo函数内的Javascript确认框[关闭]

I have a link inside PHP Echo function called "Delete". When user clicks on it, the delete.php page is called and the selected book is deleted from the database. So, I would like to insert a confirmation box asking user if he is sure to delete the book but I don't know how to do it.

This is the code:

echo "<td><a class = 'echo_link' href='delete-book.php?ID={$Book->ID}'> Delete </a></td> 
";

Please try this way. It's may helps you.

onclick="return confirm('Are you sure?');"

You can take a look at this demo : http://jsfiddle.net/dq6W6/

Use this code:

echo "<td>
<a class = 'echo_link' href='#' onclick='if(confirm(\"message\")) location.href=\"delete-book.php?ID={$Book->ID}\";'> Delete </a>
</td> 
";

Try this

echo "<td><a class = 'echo_link' onclick='return confirm('Are you sure?');' href='delete-book.php?ID={$Book->ID}'> Delete </a></td> 
";

Please try this:

echo "<td><a class = 'echo_link' href='delete-book.php?ID=5' onclick='return confirm(\"Are you sure to delete?\")'> Delete </a></td> 
";

it works perfectly....

 <a  href='http://www.google.com' onclick="return confirm('Are U sure?');"> Delete </a>

you can try this code

<?php $bookid =  $Book->ID; ?>
<td>
<a class = 'echo_link' href='<?php echo "delete-book.php?ID=$bookid"; ?>'  onclick='return confirm("Are you sure?");'> Delete </a>
</td> 
<?php echo"
";
?>