Click to See Complete Forum and Search --> : OnClick doesn't submit


FG1
09-30-2003, 07:30 AM
It would appear that using Javascript in IE6 with ASP you can't call submit() from a link's OnClick. Is this correct, or am I missing something.

As short sample follows. The file should be called Demo1.asp

FG

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- // Activate cloak

function fTest(){
document.f.submit();
}
// Deactivate cloak -->
</SCRIPT>
</head>
<body>
<form name="f" action="Demo1.asp" method="post">

<input type="text" name="frmSubmitCount" value="<% =request.form("frmSubmitCount") + 1 %>" ><br />

<a class="DryLnk" href="javascript:void(0)" onClick="Javascript:fTest()" >Doesn't Work</a><br />
<a class="DryLnk" href="Javascript:fTest()" >Works</a>

</form>
</body>
</html>

skriptor
09-30-2003, 07:49 AM
Hi,
try this:
<a class="DryLnk" href="javascript:void(0)" onClick="fTest();return false;" >Should Work</a>

Good luck, skriptor

FG1
09-30-2003, 09:31 AM
Doh!! I should have tried this. Thanks!

In a nutshell, why does it do this?

FG