JS獲取值&&文本框回車事件


<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script type="text/javascript">
        //按鈕事件
        function WS() {
            var test = document.getElementById("Text1").value;
            alert(test)
        };
        //回車事件
        function Enter(e) {
            if (e.keyCode == 13) {
                alert('click enter');
            }
        };
    </script>
</head>
<body>
    <input id="Text1" type="text" onkeypress="Enter(event)" />
    <input id="Button1" type="button" value="button" onclick="WS()" />
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM