结构-行为-样式-有趣的函数

一、按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();
发布了46 篇原创文章 · 获赞 9 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/kingbox000/article/details/50983532