Raven
07-14-2006, 08:36 PM
Hey guys, a buddy of mine is taking java in school, and is really stumped as far as this one little assignment goes.. if any of you have a spare moment or two, please look it over and see if you can find the problem..
instructions:
"when a price is entered in the "price" txt box, i need it to be multiplied by
the selected province's tax.
(which should change to 14% if ON, or BC is selected.
and all the other are 15%)
the sum of the price X the selected tax should be displayed in a message box when the "calculate"
button is clicked.
also, if a letter is entered into the "price" field, then calculate is clicked
a msg box should appear and say "enter a number" or "price is not valid"
thanks alot, anyone who can figure this out!"
CODE:
<HTML>
<HEAD>
<TITLE>In class Assignment #2</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers
//-->
</SCRIPT>
</HEAD>
<BODY>
<CENTER><H1>Provincial Tax Calculator</CENTER></H1>
<HR></HR>
<FORM>
<CENTER>Price: <INPUT TYPE="text" size ="10" name="Price" maxlength="10" value="">
<P>
<P>
<CENTER>Province
<SELECT NAME="Province">
<OPTION SELECTED>ON
<OPTION>QC
<OPTION>NS
<OPTION>NB
<OPTION>MB
<OPTION>BC
<OPTION>PE
<OPTION>SK
<OPTION>AB
<OPTION>NL
</SELECT>
<P>
<CENTER>Selected Province's Tax
<INPUT TYPE="text" size = "5" name ="CurrentTax" value="" Disabled>
<P>
<P>
<INPUT TYPE="Button" value="Calculate">
</FORM>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers
//-->
</SCRIPT>
</BODY>
</HTML>
instructions:
"when a price is entered in the "price" txt box, i need it to be multiplied by
the selected province's tax.
(which should change to 14% if ON, or BC is selected.
and all the other are 15%)
the sum of the price X the selected tax should be displayed in a message box when the "calculate"
button is clicked.
also, if a letter is entered into the "price" field, then calculate is clicked
a msg box should appear and say "enter a number" or "price is not valid"
thanks alot, anyone who can figure this out!"
CODE:
<HTML>
<HEAD>
<TITLE>In class Assignment #2</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers
//-->
</SCRIPT>
</HEAD>
<BODY>
<CENTER><H1>Provincial Tax Calculator</CENTER></H1>
<HR></HR>
<FORM>
<CENTER>Price: <INPUT TYPE="text" size ="10" name="Price" maxlength="10" value="">
<P>
<P>
<CENTER>Province
<SELECT NAME="Province">
<OPTION SELECTED>ON
<OPTION>QC
<OPTION>NS
<OPTION>NB
<OPTION>MB
<OPTION>BC
<OPTION>PE
<OPTION>SK
<OPTION>AB
<OPTION>NL
</SELECT>
<P>
<CENTER>Selected Province's Tax
<INPUT TYPE="text" size = "5" name ="CurrentTax" value="" Disabled>
<P>
<P>
<INPUT TYPE="Button" value="Calculate">
</FORM>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers
//-->
</SCRIPT>
</BODY>
</HTML>