test
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns ="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function hide() {
if(window.event.keyCode==13)
{
document.getElementById('map').style.display = 'none';
}
} // -->
</script>
</head>
<body onkeydown='hide()'> <div id='map' style='width:300px; height:200px; background-color:#ccc;'><div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns ="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function hide() {
if(window.event.keyCode==13)
{
document.getElementById('map').style.display = 'none';
}
} // -->
</script>
</head>
<body onkeydown='hide()'> <div id='map' style='width:300px; height:200px; background-color:#ccc;'><div>
</body>
</html>
document.onkeydown=function() {
if (event.keyCode==13) {
alert("enter!");
}
}
缺少对象指的就是找不到hide这个对象将声明写到前面去