[B]How do I apply the if/else statement in section B if i need to generate the alert messages? Please help me or guide me what should I do there?
In section A, when it says it should contain a <div>, does it mean that it should also have a closing </div> element? So why in 3rd result part does he specifically mentions to insert another <div> inside a <div>?
2. Section A [5 Marks]
Create a directory labtest2B under the server directory on your virtual machine. Within that directory create the html file index.html. This index.html file should contain the following elements
It should link to the JavaScript script file q2.js in the same directory
[B]a) It should contain a <div> containing (in order) the string “Input 1” (no quotes) followed by an <input> tag of type text with id “input1” (no quotes).
b) It should contain a <div> containing (in order) the string “Input 2” (no quotes) followed by an <input> tag of type text with id “input2” (no quotes)
c) It should contain a <div> containing (in order) the string “Result” (no quotes) followed by a <div> tag with id “result” (no quotes)
It should contain a <button> with onclick value “compute()” displaying the text Compute
[/B]
Section (? [5 Marks]
In j2.js, define a function compute() that does the following
[B]a) It obtains the value of the input field ‘input1″ and converts it to a Number. If this cannot be accomplished an appropriate alert is generated and the program does nothing else. Call this number n.
b) It obtains the value of the input field “input2” and converts it to a Number. If this cannot be accomplished an appropriate alert is generated and the program does nothing else. Call this number m.
c) The program then replaces the innerHTML of the “result” tag with n rows of text. Rows are terminated with the “<br>” tag. Each row consists of m ‘X’ symbols. So if n was 2 and m was 3, the output would consist of two rows of output, each with three “X”‘s in it.