文本框回车添加提交事件

it2022-05-09  25

<script type="text/javascript">

function button_translateClick() {    事件内容 }

function text_wordKeydown(e) {//这个是文本框的回车的事件,调用上边提交的事件     if (!e) e = window.event;     switch (e.keyCode | e.which | e.charCode) {         case 13:             button_translateClick();             break;     } }

</script >

<input id="text_word" type="text" value="hello" οnkeydοwn="text_wordKeydown(event)" /> <input type="button" value="提交" οnclick="button_translateClick()"/>

转载于:https://www.cnblogs.com/n666/archive/2010/01/04/2190970.html


最新回复(0)