一、按Enter键的效果:
//鼠标事件
document.onkeydown = function(event) {
if (event.keyCode == 13
&& $("#sendMsgInput").is(":focus")) {
sendMsg = $("#sendMsgInput").val().trim();
sendMessage(msgContent,1,null);
$("#sendMsgInput").val("");
return false;
}
};
二、两个循环调用的函数
var callBackTime = function (){
alert("you are so smart!");
setTimeout(callBackTime2, 2000);
}
var callBackTime2 = function () {
alert("you are really pretty good!");
setTimeout(callBackTime, 2000);
}
window.onload = callBackTime();