javascript - how to display different function in a same textbox? -


I have this HTML code with javascript. My average value is displayed correctly but nothing at all is displayed, it should show that the user clicks the minute button to find on the box.

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Calculate your grade & lt; / Title & gt; & Lt; Link rel = "stylesheet" href = "calc.css" & gt; & Lt; Script & gt; Var $ = function (id) {return document. GetElementById (id); } Var calculateGrade = function () {var exam1 = parseFloat ($ ("exam1"). Value); Var exam2 = parseFloat ($ ("exam2"). Value); Var exam3 = parseflot ($ ("exam3"). Value); If (INNA (Examination 1) || NAN (Exam 2)) {Warning ("All three entries should be numeric"); } And {var average = (Exam 1 + exam2 + test3) / 3; $ ("Average"). Value = average; }} Var min = function () {var exam1 = parseFloat ($ ("exam1") value); Var exam2 = parseFloat ($ ("exam2"). Value); Var exam3 = parseflot ($ ("exam3"). Value); If ((Examination 1 & Lt; Exam 2)) & amp; (Examination 1 & Lt; Examination 3)) {$ ("Mini"). Value = exam1;} and if ((Examination 2 & Lt; Exam1) & amp; amp;; (Exam 2 & # 39; Examination 3)) {$ ("Mini") Value = exam2;} and {$ ("mini"). Value = exam3; }} Window.onload = function () {$ ("count"). Onclick = calculateGrade; $ ("Mini"). Onclick = min; $ ("Exam1") focus () .; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Section & gt; & Lt; H1 & gt; Calculation of average & lt; / H1> & Lt; Label = "exam1" & gt; Examination 1: & lt; / Label & gt; & Lt; Input type = "text" id = "exam1" & gt; & Lt; Br> & Lt; Label = "exam2" & gt; Examination 2: & lt; / Label & gt; & Lt; Input type = "text" id = "exam2" & gt; & Lt; Br> & Lt; Label = "exam3" & gt; Examination 3: & lt; / Label & gt; & Lt; Input type = "article" id = "test3" & gt; & Lt; Br> & Lt; Label = "average" & gt; & Lt; / Label & gt; & Lt; Input type = "text" id = "average" disabled & gt; & Lt; Br> & Lt; Label & gt; & Nbsp; & Lt; / Labels & gt; & Lt; Input type = "button" id = "calculate" value = "Calc Avg" & gt; & Lt; Input type = "button" id = "mini" value = "find minimum" & gt; & Lt; / Section & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Calculate your grade & lt; / Title & gt; & Lt; Link rel = "stylesheet" href = "calc.css" & gt; & Lt; Script & gt; Var $ = function (id) {return document. GetElementById (id); } Var average = function () {var exam1 = parseFloat ($ ("exam1"). Value); Var exam2 = parseFloat ($ ("exam2"). Value); Var exam3 = parseflot ($ ("exam3"). Value); If (INN (Examination 1) || INN (Examination 2) || NN (Examination 3)) {Warning ("All three entries should be numeric"); } And {var average = (Exam 1 + exam2 + test3) / 3; $ ("Results") Value = average; }} Var min = function () {var exam1 = parseFloat ($ ("exam1") value); Var exam2 = parseFloat ($ ("exam2"). Value); Var exam3 = parseflot ($ ("exam3"). Value); If (INN (Examination 1) || INN (Examination 2) || NN (Examination 3)) {Warning ("All three entries should be numeric"); } And {$ ("result"). Value = Math (Examination 1, Exam 2, Exam 3); }} Window.onload = function () {$ ("average"). Onclick = average; $ ("Mini"). Onclick = min; $ ("Exam1") focus () .; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Section & gt; & Lt; H1 & gt; Calculation & lt; / H1> & Lt; Label = "exam1" & gt; Examination 1: & lt; / Label & gt; & Lt; Input type = "text" id = "exam1" & gt; & Lt; Br> & Lt; Label = "exam2" & gt; Examination 2: & lt; / Label & gt; & Lt; Input type = "text" id = "exam2" & gt; & Lt; Br> & Lt; Label = "exam3" & gt; Examination 3: & lt; / Label & gt; & Lt; Input type = "article" id = "test3" & gt; & Lt; Br> & Lt; Label = "average" & gt; & Lt; / Label & gt; & Lt; Input type = "text" id = "result" disabled & gt; & Lt; Br> & Lt; Label & gt; & Nbsp; & Lt; / Labels & gt; & Lt; Input type = "button" id = "average" value = "calc average" & gt; & Lt; Input type = "button" id = "mini" value = "find minimum" & gt; & Lt; / Section & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -