Look, you won't achieve anything if you work in so inaccurate manner and pay so little attention.
You have done two major bugs: misspelled (wrong capitalization) in
getElementById
(remember, this is a case-sensitive language) and, more importantly, your function is never called. Wasn't it so hard to detect? Just use some text editor's "Find", to see that the function name appears only once.
You have create a good number of other problems, such as repeating
getElementById
again and again, but it's not critical. Some are just spelling. On way to fix it all would be
<html>
<head>
<title>Emogic</title>
</head>
<body>
<input type="text" id="input"></input>
<p id="output">?</p><br/>
<button id="button">Cick here!</button>
<script>
var input = document.getElementById("input");
var out = document.getElementById("output");
function appear() {
var value = input.value;
if (value == "y")
out.innerHTML = "LIKE";
else if (value == "")
alert("You must enter a valid character.");
else
alert("Input not recognized.");
var result = out.innerHTML;
}
var button = document.getElementById("button");
button.onclick = appear;
</script>
</body>
</html>
Nevertheless, you made something to start with. From this point, better try to write all text accurately, use the debuggers (the simplest is the one which comes with Google Chrome, but its API is not the most convenient). In your CodeProject questions, never put code in comment. Put it in the body of the question and format nicely. Use the element
<pre lang="JavaScript">
// your code here
</pre>
or
<pre lang="html">
<!-- your code here -->
</pre>
Also, "alert" is only good in code under the debugging. For production, use the same kind of output as you are already using, via
innerHTML
.
Good luck,
—SA