1、情境描述html
欲实现:文本框中输入字符,点击回车,自动跳到一个新窗口且该页面不刷新ide
2、代码实现orm
HTMLhtm
<body> <input type="text" id="aa" onkeydown="enterSearch()"/> </body>
JQueryinput
function enterSearch() { if(event.keyCode==13) { window.open( "Default.aspx"); } }
注意:搜索框不能放在Form表单中,不然会刷新原页面it