|
Have you tried using your error console? There are quite a few errors, including spelling errors onclick="calcaulateTotal". You <head> tag is in the wrong place - should come after <html>.
<meta http-equiv="content-type" content="text/html; " />
is in the wrong place.
The name of the form must be in quotes - <form name= "subscriptions">
Likewise <div id="ongoing">
Likewise name="frequency" value="r" // the value is the literal letter r
Your script does not capture the values entered by the user.
var quantity // just declares the variable.
You want var qty= document.subscriptions.quantity.value; // do not use the same name for an HTML element and a Javascript variable.
You have two field with the same name - name. Ugh! You should avoid giving names or id's to your variables/functions/arguments/forms words which are HTML/JavaScript methods/properties/attributes such as 'name' or 'id' or 'value' or 'test' or 'text' or 'checked' or 'click' or 'href' or 'closed' or 'go' or 'submit' or 'replace' or 'button' or 'radio' or 'parseInt'.
As you say, it is bad. You say "we have done minimal class work on javascript" and I am afraid it shows. I do not understand why colleges expect to set assignments without providing the proper teaching and textbooks.
Tip - <script language="JavaScript"> is long deprecated.
"Knowledge is of no value unless you put it into practice.” - Anton Chekhov (Russian playwright and master of the modern short story, 1860-1904)
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
|