js中按回车键触发函数

函数

function sender() {
            if(event.keyCode===13){
             alert(“你点击了这里”);
            }

输出框中应用 onkeypress触发函数

<input id="contentSearch" type="text" onkeypress="sender()">

你可能感兴趣的:(js中按回车键触发函数)