Lessons:

  • 73. JavaScript – Introduction
  • 74. JavaScript Placement
  • 75. External JavaScript

Code:


<!DOCTYPE html>
<html>
<head>
<title>Sample JavaScript</title>

	<Script type="text/javascript" src="dogage.js">
	
	</script>

</head>

<body>

		<b>Find out your age in dog years!</b>

		<form method="post">

			<table>
			
			<tr>
			
				<td>Enter your age:</td>
				<td><input type="text" name="myage" size=15></td>
				
			</tr>

			<tr>
				<td>
				<input type="button" value="Calculate" onclick="cyears(this.form)">
				</td>
			</tr>

			<tr>
			
				<td>Your age in Dog Years is:</td>
				<td><input type="text" name="dogage" size=15></td>
				
			</tr>

			</table>

		</form>

</body>
</html>
		
		

Compiled:

Link:

Jscript.html