<textarea id= "myTextArea"></textarea>
<script type="text/javascript">
var myTextArea = document.getElementById("myTextArea");
myTextArea.onkeydown = function(e){
doSearch(e);
}
function doSearch(e){
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if(code==13 && window.event){
e.returnValue = false;
}else if(code==13){
e.preventDefault();
}
}
</script>
textarea中屏蔽回车默认换行
最新推荐文章于 2024-04-11 15:55:31 发布