duniyadnd
10-26-2002, 09:30 PM
Created this confirmation box where the user can either accept or decline going forward to another url.
however, for some reason, whenever the user accepts it, he comes back to the same page and doesn't move forward. Does anyone know what the problem might be, here's the code i've worked on so far.
**************
<a href="#" onClick="confirmDel();">Delete Entry</a>
********
<script language="JavaScript" type="text/javascript">
<!--
function confirmDel()
{
var confirmIt = confirm('Are you sure you want to delete this entry?');
if (confirmIt == true)
{
goToThisLink();
return true;
}
else
{
return false;
}
function goToThisLink()
{
return window.location.replace("http://yahoo.com");
}
}
//-->
</script>
I didn't even know that I would need to make goToThisLink function as I tried to create the forwarding url in the first if statement itself.
With this error, I come back to the same page with "#" at the end of the url. If I remove the "#" and leave a "" [in the a href tag] then i get to the index file of that directory, and if I replace the "#" with the javascript function, then it opens a new page expecting that to be the page.
thanks in advance
duniyadnd
however, for some reason, whenever the user accepts it, he comes back to the same page and doesn't move forward. Does anyone know what the problem might be, here's the code i've worked on so far.
**************
<a href="#" onClick="confirmDel();">Delete Entry</a>
********
<script language="JavaScript" type="text/javascript">
<!--
function confirmDel()
{
var confirmIt = confirm('Are you sure you want to delete this entry?');
if (confirmIt == true)
{
goToThisLink();
return true;
}
else
{
return false;
}
function goToThisLink()
{
return window.location.replace("http://yahoo.com");
}
}
//-->
</script>
I didn't even know that I would need to make goToThisLink function as I tried to create the forwarding url in the first if statement itself.
With this error, I come back to the same page with "#" at the end of the url. If I remove the "#" and leave a "" [in the a href tag] then i get to the index file of that directory, and if I replace the "#" with the javascript function, then it opens a new page expecting that to be the page.
thanks in advance
duniyadnd