You should copy the whole thing:
onclick=
"document.getElementById('WADADeleteRecordID').value=<?php echo($row_WADAhorses['horseid']); ?>;
document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';"
and put it in the <img> tag