日期:2014-05-17 浏览次数:20762 次
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#t").click(function(){
show();
});
});
function show() {
alert(1);
}
function BindEnter(event) {
if (event.keyCode == 13) {
show();
event.cancelBubble = true;
event.returnValue = false;
}
}
</script>
</head>
<body >
<div onkeypress="BindEnter(event)" style="width:200px;height:200px;background-color:red;margin-bottom:100px;">
<input type="text"/>
</div>
<button id="t">test</button>
</body>
</html>