<html>
<head>
<script type="text/javascript">
function init()
{ct=0;
function count()
{ct++
document.forms["f1"].elements["count"].Value=ct;}
}
</script>
</head>
<body>
<form name="f1">
<input type = "button" name="button2" value="Check Count" = "count()">
<input type = "text" name="count" size="5">
</form>
</body>
</html>
You really expect this to work? with
missing
}
in
init
missing
;
for
ct++
and something unknown like
"Check Count" = "count()"
Try this
<html>
<head>
<script language="JavaScript">
var count=0;
function myFun(f) {
count += 1;
f.myText.value = count;
}
</script>
</head>
<body>
<form>
<input type="text" name="myText" value=""><br>
<input type="button" name="myBut" value="Click" onClick="myFun(form)">
</form>
</body>
</html>