Your code should generate errors. Have a look at the error console (or something similar) in your browser. In this case you are missing a ‘}’ for the funky function.
Apart from that there are some other mistakes that you should be able to figure out easily when the above is fixed. (Also, the [i**] in your code is interpreted as a italics tag. You can easily avoid this by inserting spaces.)
you can try to do on the onClick event pass the event to one function, and then in the function capture if the key you’ve enter is the “enter” or another. And if it was the “enter” (with a condition in the function) do the alert (the message of the alert must be enclosed in quotes).