There are many Cat Age Calculators on the web these days but I developed this one in Active Server Pages which converts a cat's actual years to people years. Many of us have an unusual affinity for our pets, and this is a way of making us feel better that they are actual human beings inside. I also programmed a Dog Age Calculator which is beneath the Cat Age Calculator code, for those of us with a canine in mind.
The first ASP page has two text boxes, one for our cat's or dog's name, and the other for their actual years. You can put actual names and years as the default values which I have, and have other people change them accordingly. The background and pictures of course are totally up to you - I put the sound of a cat's meow on mine. These are great things to develop for kids and small students, and someday (maybe sooner or later), they may actually understand that VBScript!
For an example, please go to http://www.juliagreen.com/cat.asp
Here is the code for all 3 pages....
<html>
<head> <STYLE TYPE="text/css"> img { border: 10px double #E6D1B3 ) <BR> </STYLE> <TITLE>Cat Age Calculator</TITLE> <bgsound src="images/meow.wav" loop="2">
</head>
<body background="images/catsbg1.gif">
<H1 align="center"><font color="#800080">Julie's Cat Age Calculator</font></h1>
<center> <img src="images/cat.jpg" width="400" height="300"> <h3><font color="#800080">A cat is considered to be senior when they are 8 to 10 years of age. Cat's over 12 years of age are considered geriatric. Phoenix, my house cat, is 12 years old.</font></h3> <p><h3> <font color="#800080"> To all those cats out there!, The longest a cat has ever lived is 34 years.</font></h3><p>
<form action="cat2.asp" method="post"> <b> <font color="#800080"> What is the name of your cat?<p> <input type="text" name="name" size="10" value="Phoenix"><p> What is the age of your cat in real years?<p> <input type="text" name="age" size="10" value="12"> years</font> <P> <input type="submit"><input type="reset"> </center> </form> <a href="dog.asp"><b><h2 align="center"><font color="#800080">Go to Dog Age Calculator!!</font></b></a></h2>
</html> |
Cat 2, the processing page
<%Option Explicit%>
<html>
<head> <STYLE TYPE="text/css"> img { border: 10px double #E6D1B3 ) <BR> </STYLE> <title>CAT AGE CALCULATOR ANSWER</title> <bgsound src="images/meow.wav" loop="1">
</head>
<body background="images/catsbg1.gif">
<h1 align="center"><font color="#9900CC">CAT AGE CALCULATOR ANSWER</font></h1> <center> <img src="images/tiger1s.jpg" border="4"> </center>
<%
Dim age2, age3, varAge, varName
varAge=Request.Form("age") varName=Request.Form("name")
If varAge = 1 Then age2=15 End If If (varAge > 1) Then age2=(varAge*5) + 10 End If If varAge = 7 Then age2=45 End If If (varAge > 7) Then age2=(varAge*4) + 17 End If If varAge=10 Then age2=58 End If If (varAge > 10) Then age2=(varAge*5)+8 End If If varAge=15 Then age2=78 End If If (varAge>15) Then age2=(varAge*4)+18 End If If varAge=20 Then age2=98 End If If varAge > 20 Then Response.Write "<br><center><h1>You're over 100 kitty!</h1></center>" End If
Response.Write "<center><b><i><font size=+2><font color=#9900CC>" & varName Response.Write "<b><i><font size=+2><font color=#9900CC>'s people age is " Response.Write "<b><i><font size=+2><font color=#9900CC>" & age2 Response.Write "<b><i><font size=+2><font color=#9900CC> years." Response.Write "</center>"
%> <p><p> <center> <img src="images/kitty.jpg" height="248"><p> <a href="cat.asp"><b><i><font size="4">Go back to Cat Calculator!!</font></i></b></a> </html>
|
The DOG AGE CALCULATOR
The same technique is used, an ASP page with a name and age textbox. I've just put the resulting asp code here, instead of the originating page.
For an example, go to www.juliagreen.com/dog.asp.
<%Option Explicit%> <html> <head> <STYLE TYPE="text/css"> img { border: 10px double #800000 ) <BR> </STYLE> <title>DOG AGE CALCULATOR ANSWER</title> </head> <body bgcolor="#800000" text="#FFFFFF" background="images/pawsback.jpg">
<h1 align="center"><font color="#800000">DOG AGE CALCULATOR ANSWER</font></h1> <font color="#800000"> <center> <img src="images/dogsad.jpg"> </center>
<%
Dim age2, age3, varAge, varName
varAge=Request.Form("age") varName=Request.Form("name") If varAge = 1 Then age2=15 End If If varAge = 2 Then age2=24 End If If varAge > 2 Then age2=15+(varAge*4) End If If varAge=21 Then Response.Write "<b><i><font size=+2><font color=#800000>" & varName Response.Write "<b><i><font size=+2><font color=#800000>! You're one year short of a 100! " Response.Write "<b><i><font size=+2><font color=#800000>That's a doggone long time!" End If If varAge>21 Then Response.Write "<b><i><font size=+2><font color=#800000>" & varName Response.Write "<b><i><font size=+2><font color=#800000>! Guess what, you're a Centurion! " End If
Response.Write "<br><br><b><i><font size=+2><font color=#800000>" & varName Response.Write "<b><i><font size=+2><font color=#800000>'s people age is " Response.Write "<b><i><font size=+2><font color=#800000>" & age2 Response.Write "<b><i><font size=+2><font color=#800000> years."
%> </font> <p><p align="center"> <a href="dog.asp"><b><h2 align="center"><font color="#800000">Go back to Dog Calculator!!</font></b></a></h2> <p align="center"><p align="center"> <a href="cat.asp"><b><h2 align="center"><font color="#800000">Go back to Cat Calculator!!</font></b></a></h2>
</html>
-->
|