由于我的情况很多串联,我无法弄清楚我的onclick = "return confirm('Are you sure?')
放在哪里,所以请帮助我们。这是我的代码:
echo "<td><a href='" . base_url().'admin/play/delete/' .$row->id."onclick="."return confirm('Are you sure?')".'>" . "<img src='".base_url()."admin_css/images/delete.png' title='delete' "/></a>"/></a>"."<a href='".base_url().'admin/play/fav/' . $row->id . "'>" ."<img src='".base_url()."admin_css/images/star.png' title='edit'/>"."</a></td>";
需要帮助。
答案 0 :(得分:2)
请尝试此代码
echo '<td><a href="'.base_url().'admin/play/delete/'.$row->id.'" onclick="return confirm(\'Are you sure?\')" ><img src="'.base_url().'admin_css/images/delete.png" title="delete" /></a><a href="'.base_url().'admin/play/fav/'.$row->id.'" ><img src="'.base_url().'admin_css/images/star.png" title="edit" /></a></td>';
答案 1 :(得分:1)
简单明了
<td>
<a href="<?php echo base_url(); ?>admin/play/delete/<?php echo $row->id; ?>" onclick="return confirm('Are you sure?')">
<img src="<?php echo base_url(); ?>admin_css/images/delete.png" title="delete"/>
</a>
<a href="<?php echo base_url(); ?>admin/play/fav/<?php echo $row->id; ?>">
<img src="<?php echo base_url(); ?>admin_css/images/star.png" title="edit"/>
</a>
</td>
答案 2 :(得分:1)
我创建它只是为了更好地了解你。 祝你好运。
echo '<td>';
echo '<a href="'.base_url().'admin/play/delete/'.$row->id.'" onclick="return confirm(\'Are you sure?\')" >';
echo '<img src="'.base_url().'admin_css/images/delete.png" title="delete" />';
echo '</a>';
echo '<a href="'.base_url().'admin/play/fav/'.$row->id.'" >';
echo '<img src="'.base_url().'admin_css/images/star.png" title="edit" />';
echo '</a>';
echo '</td>';