Lab15
This commit is contained in:
25
Chapter ZIPs/JavaScript/ch7/ex_7_4.html
Executable file
25
Chapter ZIPs/JavaScript/ch7/ex_7_4.html
Executable file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Example 7.4</title>
|
||||
<script>
|
||||
function getAges()
|
||||
{
|
||||
var age = 0;
|
||||
age = parseInt(prompt("How old is your grandmother?"));
|
||||
pet();
|
||||
function pet()
|
||||
{
|
||||
age = parseInt(prompt("How old is your puppy?"));
|
||||
document.getElementById('puppy').innerHTML = (age +10);
|
||||
}
|
||||
document.getElementById('granny').innerHTML = (age + 10);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body><table align="center" width = "70%"><tr><td><br />
|
||||
<input type ="button" onclick="getAges()" value = "Find the age in 10 years"></button><br />
|
||||
<h3>Your granny's age in 10 years: <span id = "granny"> </span></h3>
|
||||
<h3>Your puppy's age in 10 years: <span id = "puppy"> </span></h3>
|
||||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user