Recently I have started playing with jQuery, and have been following a couple of tutorials.
(最近,我开始使用jQuery,并且已经关注了一些教程。)
Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my webpage (as in, you press the ` key like you do in FPS games, etc.), and then have it Ajax itself back to the server in-order to do stuff. (现在,我觉得使用它有点能力(这很容易),而且我认为如果能够在网页上制作一个“控制台”(例如,像在FPS游戏中一样按下“键”,等),然后将Ajax本身返回到服务器以执行操作。)
I originally thought the best way would be to just get the text inside the textarea, and then split it, or should I use the keyup event, convert the keycode returned to an ASCII character, append the character to a string and send the string to the server (then empty the string).
(我本来以为最好的方法是将文本放入文本区域内,然后将其拆分,或者我应该使用keyup事件,将返回的键码转换为ASCII字符,将该字符附加到字符串中并将该字符串发送到服务器(然后清空字符串)。)
I couldn't find any information on getting text from a textarea, all I got was keyup information.
(我找不到有关从文本区域获取文本的任何信息,我所得到的只是键盘信息。)
Also, how can I convert the keycode returned to an ASCII character? (另外,如何将返回的键码转换为ASCII字符?)
ask by RodgerB translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…