hi,
need some help with a javascript function i am writing. This is what I have so far:
HTML page with php echoing some stuff from a query:
The story is that I have a php file which dynamically generates links to perform a delete of each file. I have set the link onclick to point to the above javascript. The confirm window pops up ok but when I click on cancel it still proceeds with the file delete i.e. it continues to follow the link. How can I stop this from happening? I thought whenever I used the history -1 in the javascript that the php page would no longer execute?
Would appreciate some help on this!
Cheers
need some help with a javascript function i am writing. This is what I have so far:
Code:
<script language="javascript" type="text/javascript" >
function confirm_delete() {
if (confirm('Proceeding with this task will permanently delete some files from your server. Continue?')) {
alert('This theme will now be deleted');
}
else {
alert('You will now be redirected back to the previous page');
history.go(-1);
break;
}
}
</script>
HTML page with php echoing some stuff from a query:
Code:
<a href="delete_theme.php?theme=' .$row['themeID'] . '" onclick="confirm_delete()">
The story is that I have a php file which dynamically generates links to perform a delete of each file. I have set the link onclick to point to the above javascript. The confirm window pops up ok but when I click on cancel it still proceeds with the file delete i.e. it continues to follow the link. How can I stop this from happening? I thought whenever I used the history -1 in the javascript that the php page would no longer execute?
Would appreciate some help on this!
Cheers