<script type="text/javascript">
//Confirm Delete
function confirms(id) {
var test=confirm("Confirm Delete?");
if(test== true)
window.location="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>&did="+id;
else
window.location="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>&did="+id;
}
</script>
答案 0 :(得分:6)
它并不总是返回true。无论如何,您的脚本始终运行相同的代码。它等同于:
<script type="text/javascript">
//Confirm Delete
function confirms(id) {
window.location="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>&did="+id;
}
</script>