js兼容firefox和ie的ctrl+enter事件捕获

html代码:

<textarea onkeypress="capture(event,this)"></textarea>

js代码:

function capture(event,o)
{
         var keynum;
         if(window.event)
         {
              keynum=event.keyCode;
         }
         else
         {
              keynum=event.which;
         }
         event = event || window.event;
         if(event.ctrlKey&&(keynum==13||keynum==10))
         {
              alert('ctrl+enter事件');
         }
}