我应该在脚本中写些什么来删除行
<script type="text/javascript">
function confirmation()
{
var del=confirm("Are you sure you want to delete this record?");
if (del==true){
alert ("record deleted")
}
return del;
}
</script>
体内
<td><a href="movie_list(delete).php?view&movid" onclick="return confirmation();">Delete</a></td>
这部分我应该怎么做?
<?php
if (isset(.....)
{
....
header("Location: .....php");
}
?>
答案 0 :(得分:1)
将此添加到您的删除按钮
onclick="return confirmDelete();"
将此内容粘贴到页面的页眉或页脚。
<script>function confirmDelete() {
if (confirm("Sure you want to delete ?") == true) {
return true;
} else {
return false;
}
}
</script>
答案 1 :(得分:0)
<td><button onclick="return confirmation();">Delete</button></td>
<input type="hidden" name="movid" value="<?php echo 10; ?>">
<script type="text/javascript">
var movid = $('#movid').val();
function confirmation()
{
if (confirm("Are you sure you want to delete this record?"))
{
alert ("record deleted");
window.location.href='movie_list(delete).php?movid='+movid;
}
}
</script>
//在movie_list(delete).php上
<?php
if (isset($_GET['movid'])) {
header("Location:index.php");
}
?>