基本信息
源码名称:回车键发表评论
源码大小:0.67KB
文件格式:.zip
开发语言:js
更新时间:2020-10-28
   源码介绍

<!DOCTYPE html>
<html>
<head>
<title>回车发表评论</title>
<script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
<style>
#input_one{
    width: 100px;
    height: 50px;
}
#input_two{
    width: 300px;
    height: 300px;
}
</style>
</head>
<body>
    <input type="text" id="input_one">
    <input type="text" id="input_two">
    <script>
        var input_one=document.getElementsByTagName("input")[0];
        var input_two=document.querySelector("#input_two");
        $(document).on("keyup",function(e){
    var m_e = e || window.event;
    var keycode = m_e.which;
    if(keycode === 13){
        
            input_two.value=input_one.value;
            input_one.value=null;
        
    }
        });
    </script>
</body>
</html>