Dear All,

I have a problem with delete confirmation code in java script.

i m using this code:

<script LANGUAGE="JavaScript">

function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
	
}

</script>

in Asp page on click of hyperlink tage message displays and on click of Cancel the next page is called where as in simple html file hyper tag code acts properly.

please suggest in this regars what i have to day and where i m making mistake

What about just doing something like: <a href="delete.asp" onclick="return confirm('Are you sure you wish to continue?')">Delete</a> Or, if you need a function for several links:

<script type="text/javascript">
function confirmSubmit(){
return confirm('Are you sure you wish to continue?');
}
</script>
<a href="delete.asp" onclick="return confirmSubmit();">Delete</a>

Try like this:

<script language="JavaScript" type="text/javascript">
var d = document.form1;						
	function del(x)
	{
						if(confirm("You want to delete this record"))
					{
					d.submit();
					}
				
			return;
	}
        </script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.