|
5 | 5 | *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.*
|
6 | 6 |
|
7 | 7 | ### Assingment Requirements
|
8 |
| -* File Structure |
| 8 | +1. File Structure |
| 9 | + |
9 | 10 | * Create two simple html pages
|
10 | 11 | - [x] index.html contains an HTML form that needs to be validated by JavaScript when submitted.
|
11 | 12 | - [x] excel.html contains a simple form to let the user enter their numeric values then you will use
|
|
26 | 27 | e.g: JS-Assignment-Martin
|
27 | 28 |
|
28 | 29 | 
|
| 30 | +2. Home Page |
29 | 31 |
|
30 | 32 | * You will create a web form to ask the user to enter the following information using the appropriate
|
31 | 33 | HTML5 form controls (elements) to represent each item in the list below:
|
|
44 | 46 | take all the form information (user’s input)
|
45 | 47 | - [x] Cancel button to reset the form elements
|
46 | 48 |
|
| 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 | + |
47 | 85 | ### Built With
|
48 | 86 | This section lists the languages I used to built this project.
|
49 | 87 | * [HTML](https://en.wikipedia.org/wiki/HTML)
|
|
0 commit comments