Ctrl+Enter 提交聊天信息

 1     window.onload = function() {
 2         var content = document.getElementById("content");
 3         var info = document.getElementById("info");
 4         var btn = document.getElementById("btn");
 5 
 6         info.onkeydown = function(ev) {
 7             var oEvent = ev || event;
 8             
 9             if (oEvent.ctrlKey && oEvent.keyCode === 13) {
10                 content.value += info.value + "\n";
11                 info.value = "";
12             }
13         };
14 
15         btn.onclick = function() {
16             content.value += info.value + "\n";
17             info.value = "";
18         };
19     };

 

posted @ 2015-12-24 20:18  叫我霍啊啊啊  阅读(138)  评论(0编辑  收藏  举报