文本框添加回车时间

1.<input id="key" type="text" onkeypress="if(event.keyCode == 13)keysearch();"/>

2.     document.onkeydown = keydown;
        function keydown(e) {
            //关键字搜索
            var currKey = 0, e = e || event;
            if (e.keyCode == 13) {
                keysearch()
            };
        }

posted @ 2013-05-17 09:24  soulfree  阅读(247)  评论(0编辑  收藏  举报