<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript"> function OnKeyUp(_e) { //var e = _e?_e:window.event;//获取有效的的事件对象 if(event.keyCode == 13)//按下的是否是回车键 { alert("你输入的内容是:"+Text1.value); } } </script> </head> <body> <h1>事件处理事例</h1> <input id="Text1" type="text" onkeyup="OnKeyUp()" style=" 423px;height: 178px;" /> </body> </html>