|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hi , I am trying to store guesses from the text box into the Array. and it will not do it. Could you help me out?? here is my code.
//<html> // <head> // <title>Javascript Assignment III</title> // </head> // <body> // <script language="javascript"> // <!-- // var myNumber = Math.random()*10; // var Number = Math.round(myNumber); // document.write(Number); // var Guess = new Array(); // function Check(dataAccept) // { // var InputBox1 = eval(document.frmRandom.guess.value) // if (InputBox1 < 0 || InputBox1 > 100) // { // window.alert("Error: you are out of range, pick again."); // } // if (InputBox1 == Number) // { // window.alert("Correct"); // for (p=0;p<=0;p++) // { // Guess[p] = InputBox1 // } // for (n=0; n<=Guess.length-1;n++) // { // document.write("<b>"+"<font color ='blue'>"+"YOU WIN"+"</font>" + "</b>" + "<br/>" + "The correct number was: " + "<b>" + Number + "</b>" +"<br/>" + "Previous Guesses: " + // "<br/>" + Guess.length + ": " + p + "<br/>" + "Number of guesses used: " + "<b>" + Guess.length + "</b>" + "<br/>" + // "<br/>" + "<a href='JSassignment3.htm'>" + "Click to play again" + "</a>"); // } // } // if(InputBox1 > Number) // { // window.alert("Lower. You have " + Guess + "guesses left!"); // } // else if (InputBox1 < Number) // { // window.alert("Higher. You have " + Guess+ "guesses left!"); // } // } // //--> // </script> // <h3>Javascript Assignment III</h3> // Number guessing game.<br/> // <br/> // Please enter your guess between 1 and 100:<br/> // <form name="frmRandom"> // <input name="guess" type="text" size="5" /> // <input name="checkGuess" type="button" value="Check" onClick="Check(Number);"/> // </form> // </body> //</html> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Storing from text boxes into arrays |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|