---
title: "js    回车键"
author: "hwpok"
date: "2008-05-13T11:45:00Z"
tags: []
slug: "js"
draft: false
lastmod: "2008-05-13T11:45:00Z"
id: 615907
url: "https://hwpok.iteye.com/blog/615907"
---

&lt;html&gt;  
    &lt;head&gt;  
        &lt;script language='javascript'&gt;  
      function document.onkeydown(){  
           if (event.keyCode == 13){  
              alert('惠万鹏你好.');  
           }else{  
              alert('你按错了键.');  
           }  
          }  
        &lt;/script&gt;  
    &lt;/head&gt;  
   &lt;body&gt;  
       &lt;input type='button' value='test'/&gt;  
   &lt;/body&gt;  
&lt;/html&gt;