<!DOCTYPE html>
<html>
<head>
<title>calculate length of the string</title>
</head>
<body>
<h1>calculate length of the string</h1>
<form name="f1">
<input type="submit" value="calculate length" onclick="length()">
</form>
<script type="text/javascript">
function length()
{
event.preventDefault();
var str;
str="Information Technology";
document.write("Length of the string=" + str.length);
}
</script>
</body>
</html>