<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
 <SCRIPT LANGUAGE="JavaScript">
function ctlent()
{if(event.ctrlKey && window.event.keyCode==13)
alert("hahaha")
}
 </SCRIPT>
</head><body>
<textarea rows="20" cols="50" onkeydown="ctlent()"></textarea></body>
</html>

解决方案 »

  1.   


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <SCRIPT LANGUAGE="JavaScript">
    function ctlent(e)
    {
    var e = e||window.event
    if(e.ctrlKey && e.keyCode==13)
    alert("hahaha")
    }
     </SCRIPT>
    </head><body>
    <textarea rows="20" cols="50" onkeydown="ctlent(event)"></textarea></body>
    </html>
      

  2.   


    那个 e=e||window.event;是兼容的写法。
      

  3.   

    HTML code 
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title>无标题文档 </title> 
    <SCRIPT LANGUAGE="JavaScript"> 
    function ctlent(e) 

    var e = e ¦ ¦window.event 
    if(e.ctrlKey && e.keyCode==13) 
    alert("hahaha") 

    </SCRIPT> 
    </head> <body> 
    <textarea rows="20" cols="50" onkeydown="ctlent(event)"> </textarea> </body> 
    </html> 
      

  4.   

    <form name="form1" method="post" action="">
      <input type="text" name="name">
      <textarea name="textarea" onKeyDown="ctlent()"></textarea>
      ctrl+"回车键提交"
    </form>
    <script type="text/javascript">
    function ctlent(){
    if(event.ctrlKey && window.event.keyCode==13)
    document.form1.submit();
    }
    </script>