css - Javascript random number loops undefined onclick -


I can not find the error within my code, whenever I try to run it, onclick returns with an error" LoopNums is not defined ". The user can enter a number between only 1 and 15, and the loop will generate 10 random numbers between the user input and to determine which partiality is or not.

& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; Script type = "text / javscript" & gt; Function loopNums () {var usernum = parseInt (document.getElementById ("usernum") value.); Var Message = ""; Var sum = 0; If (Username and lieutenant; 1 || Username * 15) {msg = "Enter number between 1 and 15"; } Else {for (Var I = 0; I & lt; 10; i ++) {var rdnNumber = Math.floor (math.random () * (1 + 100 - usernum)); usernum; If (rdnNumber% usernum === 0) msg ​​+ = "
"; Rest of the message + = "& lt; div style = 'color: red' & gt; Number generated:" + rdnNumber + usernum + "is not divisible by it." "& Lt; / div & gt ;!"; }} Document.getElementById ("Result"). InnerHTML = msg; } & Lt; / Script & gt; & Lt; Style type = "text / css" & gt; Body {background color: # 996666; Font-family: aerial; Color: # 996666; } #contentwaps {background-color: #FFCC66; Border: 8px # FF9933 solid; Padding: 20px; Width: 600px; Margin: 20 px auto 0 px auto; Range radius: 25px; Text align: center; } #heading {font-size: 2.2em; Border Bottom: 6px # 663399 Double; Padding: 10px 0px 10px 0px; } #formdiv {text-align: center; Padding-top: 25px; }. Formtext {text-align: center; Font size: 1.2 9em; Margin-top: 20px; } #usernum {border: 2px # 663399 solid; } #treets {font-size: 1em; Color: # FF0000; } & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "contentwrap" & gt; & Lt; Div id = "heading" & gt; Loop Practice & lt; / Div & gt; & Lt; Div id = "formdiv" & gt; & Lt; Form & gt; Enter a number & lt; Br / & gt; & Lt; Input type = "text" id = "usernum" /> & Lt; P / & gt; & Lt; Input type = "button" value = "go for it!" OnClick = "loopNums ()" /> & Lt; / Form & gt; & Lt; Div id = "result" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;! - ends with div # contentwrap - & gt; & Lt; / Body & gt; & Lt; / Html & gt;

"itemprop =" text ">

There is a real problem with your script & lt; Script> tags This is called javscript, and should be javascript.


Comments