<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>测试</title>
</head>
<body>
<textarea name="" id="tex2" cols="30" rows="10"></textarea>
<input type="text" id="tex1" >
<input type="button" id="btn1" value="提交">
<script>
var oBtn=document.getElementById('btn1');
var oTex1=document.getElementById('tex1');
var oTex2=document.getElementById('tex2');
oBtn.onclick=function(){
oTex2.value+=oTex1.value;
oTex1.value='';
}
oTex1.onkeydown=function(ev){
var oEvent=event||ev;
if(oEvent.ctrlKey && oEvent.keyCode==13){
oTex2.value+=oTex1.value;
oTex1.value='';
}
}
</script>
</body>
</html>
//oEvent.ctrlKey(ctrlKey、shiftKey、altKey)返回布尔值,altKey不常用