Jump to content

N0Lif3

Members
  • Posts

    6
  • Joined

  • Last visited

N0Lif3's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hazaa! I got it to work. I needed help to do it, but I'm quite proud of myself that I got a script to work now WORKING SCRIPT!!! <!DOCTYPE html><html><head><script> function myFunction() {var x="";var y=document.getElementById("guesshere").value;//apple is the keycode, one of many keycodes to comevar keycodes="apple"; if (y == keycodes) { x="correct" }else { x="incorrect" } document.write(x); }</script></head><body> <input type='text' id='guesshere' value='Enter Text Here' /><input type='button' onclick='myFunction()' value='Submit'/> </body></html> EDIT: I want to change two things. My next step is to change how it outputs the answer, so it displays below the input box without wiping the whole page. Second, is there a way I can make the "keycodes" variable look at a text file for all of the keycodes? Say, I have a text file with a 100 keycodes.
  2. Ok, I've some more reading and seriously put a lot of thought into it this time. This absolutely should work,. it makes sense to me, but it doesn't. What am I missing? This SHOULD work! <!DOCTYPE html><html><head><script> function myFunction() {var x="";var y=document.getElementById("guesshere").value;//apple is the keycode, one of many keycodes to comevar 1="apple"; if (y=1) { x="correct" }else { x="incorrect" }document.write(x); }</script></head><body> <input type='text' id='guesshere' value='Enter Text Here' /><input type='button' onclick='myFunction()' value='Submit'/> </body></html> Come on, it's elegant and simple. This should be flawless!edit: if I didn't make it clear, it doesn't work, but I think it should.
  3. Here's my honest attempt at it. <!DOCTYPE html><html><head><script>function myFunction() { //apple is the keycodevar 1 = text(apple);var x = document.getElementById("guesshere"); if (1) { function changeText(){ document.getElementById('guesshere').innerHTML = "correct"; } }else { function changeText(){ document.getElementById('guesshere').innerHTML = "incorrect"; } } }</script></head><body> enter keyword <input type="text" id="guesshere" onchange="myFunction()"><p>When you leave the input field, a function is triggered which transforms the input text to "correct" or "incorrect"</p> </body></html> edit: ^^^ the above code here doesn't work at all!edit 2: some of it I'm sure doesn't make sense, I'm just taking code here and there from tutorials and it's like my 5th or 6th go at it and I keep changing it around.edit 3: I do see that my "x" variable doesn't fit in here. I'm awful at this and I'm trying to think of a way to simplify as much as possible. A "1" should be the correct keyword. Anything that is the correct keyword should be a 1 in the backend. So if you guess correctly, 1 sends a "you are correct" message to x. "x" is the input box where you can put in any word. Man, I just don't know how to make this work, as simple as it should be. I just don't know what to do.
  4. Thanks for all the help and suggestions thus far, guys. I've been trying to implement Ingolme's script above, trying to mix it into other tutorial scripts I've found online, but I can't get it to work. I'm just bad at this. How do I make it work in html? Believe me, I've been trying to get it to work. <body><form> Enter your keyword guess here! </form><input type="text"><script> *Ingolme's script here* </script></body>
  5. is there an easier, more simple way?
  6. I want to make a simple website-based program where you enter a word into the text input form and press enter, if that word is in the list of keywords that is hidden in the backside of the website, then you get a positive prompt saying you got a correct word and if you enter a word that isn't in my list of keywords then you get a negative prompt saying you didn't enter a correct word, then I'd like to add a third result for if you entered nothing at all and pressed enter. Example, let's say in my hidden list of keywords I have the words YELLOW, WHITE, and RED in there. If you go to the website and enter "WHITE," a word that is in my keyword list, you are prompted with a message saying it's in there If you go to the website and enter "APPLE," a word that isn't in my keyword list, you are prompted with a message saying that the word isn't in that list. I think Javascript would be the easiest way to do this. Also, how could I hide my keyword list so users snooping through the website couldn't find it? I'm not sure how to make such a javascipt program, I would love it if somebody could help me. It would be a great learning experience
×
×
  • Create New...