Skip to content

Commit aae8ef2

Browse files
committed
Updated
1 parent 43ab4a7 commit aae8ef2

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
*This assignment demonstrats my skills using HTML form elements and JavaScript topics such as: Functions, parsing the DOM, form validation, conditional statements, debugging methods, formulas and Math Object.*
66

77
### Assingment Requirements
8-
* File Structure
8+
1. File Structure
9+
910
* Create two simple html pages
1011
- [x] index.html contains an HTML form that needs to be validated by JavaScript when submitted.
1112
- [x] excel.html contains a simple form to let the user enter their numeric values then you will use
@@ -26,6 +27,7 @@
2627
e.g: JS-Assignment-Martin
2728

2829
![File structure](/img/dom.PNG)
30+
2. Home Page
2931

3032
* You will create a web form to ask the user to enter the following information using the appropriate
3133
HTML5 form controls (elements) to represent each item in the list below:
@@ -44,6 +46,42 @@
4446
take all the form information (user’s input)
4547
- [x] Cancel button to reset the form elements
4648

49+
3. Excel Page
50+
51+
* Design a web form following the wireframe guidelines below. Notice that the image below is just a
52+
sample so you can use any styles like colour, font, layout, width, or borders plus any HTML Tags that you
53+
prefer
54+
* User can type his/her numbers with a space between each number (as a string with the space
55+
character as a delimiter or space separated numeric values) inside an input box (You need to notify
56+
the user to enter the numbers with a space between every two numbers as shown in the diagram)
57+
* Then the user can choose only one of the basic excel functions (radio buttons) to do the required
58+
calculation
59+
* When the button “Calculate” is clicked, a function named myExcelFuns() will be loaded (triggered) so
60+
you will need to add “onClick” event to the form button “Calculate”, and inside myExcelFuns function
61+
body (block) you will have to do the following:
62+
- [x] Get the user input (string of numbers and spaces) and save it into a variable named “numberStr”
63+
- [x] Make sure to remove all the extra spaces before and after the user input (Remove whitespace from
64+
both sides of a string) using the appropriate JavaScript built-in method
65+
- [x] Convert the string user input “numberStr” into an array of numbers named “numberArr” using the
66+
appropriate JavaScript built-in method for array object
67+
* Continuing inside myExcelFuns(), you will use if condition to scan or to check which radio button was
68+
selected and based on this selection you will do the right calculations
69+
- [x] Use if else blocks to do the required calculation based on the selected radio button:
70+
* If (the AutoSum radio is checked) ➔ Do the calculation to find the total of all the numbers
71+
* else if (the Average radio is checked) ➔ Do the calculation to find the average of the numbers
72+
* else if (the Max radio is checked) ➔ Do the calculation to find the maximum number
73+
* else ➔ Do the calculation to find the minimum number
74+
- [x] The returned value for each if condition has to be saved into a global variable based on our
75+
function (it’s a local variable based on the entire JS file) named “result”, so you will need to declare
76+
this empty variable first, then use it inside each if condition and else block
77+
* There is more than one way to get the selected radio button option, one of them for example, is to
78+
give each radio button control an “id” in your HTML code:
79+
* <input type="radio" name="excel" id="sum">AutoSum
80+
* <input type="radio" name="excel" id="avg">Average
81+
* At the end of all the if else blocks (4 blocks), use the getElementById() method to print your result (the
82+
value of the result variable) into your specific HTML element.
83+
84+
4785
### Built With
4886
This section lists the languages I used to built this project.
4987
* [HTML](https://en.wikipedia.org/wiki/HTML)

0 commit comments

Comments
 (0)