The way that code should work (given no other scripts that would conflict or otherwise affect the outcome) in any browser is, if someone confirms, then page.htm will be loaded into the current base window (usually the current window). If they do not confirm, no change in the current page should occur.
But, there is no real link in your code:
Code:
<a href="page.htm" title="delete" onClick="return confirmSubmit()">
With only that, there is no closing </a> tag and no text or image to click on to activate it.
If you do:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script LANGUAGE="JavaScript">
<!--
function confirmSubmit()
{
var agree=confirm("Are you sure you want to delete?");
if (agree)
return true ;
else
return false ;
}
// -->
</script>
<a href="page.htm" title="delete" onClick="return confirmSubmit()">Huh</a>
</body>
</html>
Then it works just as I predicted in FF.
What exactly is happening?
Please post a link to the page on your site that contains the problematic code so we can check it out.
Note: The language attribute for the script tag is deprecated, and the type attribute is required.
Bookmarks