web programming_javascript: Error with Grade result in javascript -


I have created a student information javascript. Everything is fine, but I have a problem in the result of the student's grades. It always tells grade F each score.x When the total score is 100 then this show is F, but when the total score is 500 then it is still showing F. Here is my code of Java and html

  'var column = ["id", "name", "gender", "javascript", "data structure", "network", "vbnet "," Coral draw "," total "," average "," grade "]; Var arr = ["," "," "," 0 "," 0 "," 0 "," 0 "," 0 "," 0 "," 0 "," "]; Var i = 0; Var j = 0; Var x; Grade of grade; If (ARR [8]> = 450 & amp; AR [8] & lt; 500) grade = "A"; And if (ARR [8]> = 400 & amp; amp; amp; [8] & lt; 450) grade = "B"; And if (ARR [8]> = 350 & amp; amp; amp; amp; [8] & lt; 400) grade = "C"; And if (ARR [8]> = 300 & amp; amp; amp; amp; [8] & lt; 350) grade = "D"; And if (ARR [8]> = 250 & amp; amp; amp; amp; amp; amp; [8] & lt; 300) grades = "E"; Other (ARR [8] & lt; 250) grade = "F"; X = parseInt (window.prompt ("Student number")); For (j = 0; j & lt; = x-1; j ++) {// (i = 0; i & lt; = 7; i ++) {arr [i] = window.prompt ("Please input" + column [i]); } [ARR [5] Arr [9] = parseint (ARR [8]) / 5; Advent [10] = Grade; document.write ("& lt; tr & gt;"); For {i = 0; i & lt; = 10; i ++} {// document.write ("& lt; td>" + arr [i] + "& lt; / td> ); } Document.write ("& lt; / tr & gt;"); //} document.write ("& lt; / table>");   


  & lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Korm-Chantola & lt; / Title & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "style for table.css" & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div class = "watermark" & gt; Com-Chatola & lt; Br> ID-B121561 & lt; Br> Room A201 & lt; / Div & gt; & Lt; Center & gt; & Lt; H1 & gt; Student score information & lt; / H1> & Lt; Table class = "table 1" limit = "5" padding = "2px" width = "700px" & gt; & Lt; Tr & gt; & Lt; Th & gt; Id & lt; / Th & gt; & Lt; Th & gt; Name & lt; / Th & gt; & Lt; Th & gt; Gender & lt; / Th & gt; & Lt; Th & gt; JavaScript & lt; / Th & gt; & Lt; Th & gt; Data structure & lt; / Th & gt; & Lt; Th & gt; Network & lt; / Th & gt; & Lt; Th & gt; VB.net & lt; / Th & gt; & Lt; Th & gt; Coral draw & lt; / Th & gt; & Lt; Th & gt; Total & lt; / Th & gt; & Lt; Th & gt; Avg & lt; / Th & gt; & Lt; Th & gt; Grade & lt; / Th & gt; & Lt; / TR & gt; & Lt; Script type = "text / javascript" src = "jscript.js" & gt; & Lt; / Script & gt; & Lt; / Center & gt; & Lt; / Body & gt; & Lt; / Html & gt;   


  table. 1, TD, th (range: 1 px solid black;} table.table1 td {text-align: center; height: 50px; vertical-alignment: bottom; padding: 15px; background color: #CCCCCC; color: # 0D3821;} Table.table1 th {color: white; background color: # 3B3B99; padding: 10px;} H1 {text-shadow: 15px 10px 8px black; text align: center; text-decoration: underline; color: # 1C127D;} body {background color: # E6E6E6;} watermark {status: left; ambiguity: 0.25; font size: 2em; width: 100%; text align: left; Z-index: 1000;}   

! [This is a screenshot of the problem] [10]

If you are less than 500, then you are doing the test, it is not that it will fall in the second condition and change it to Lt; = 500 and it should work for grade A.

The second problem is (ARR [8] & lt; 250) The second condition is that if the result of the block is being executed, the following line of code is grade = "F" because it is The fiber will be set on F, even if it is in any block. <2>

Indication: also for a line block [2]

If within a statement I like to wrap blocks in {}. In this way it is very easy to see what is going on (in the above case it throws a syntax error).

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -