Home  >  Article  >  Backend Development  >  原来是按enter可能提交按钮提交信息的,按刷新键也会自动提交

原来是按enter可能提交按钮提交信息的,按刷新键也会自动提交

WBOY
WBOYOriginal
2016-06-13 10:59:05738browse

原来是按enter或者提交按钮提交信息的,按刷新键也会自动提交

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script language="javascript">//判断用户是否按回车键且转出的内容是否为空function inputKeyPress(){    if((event.keyCode==13)&&(document.all.chatWord.value!=null)&&(document.all.chatWord.value.length>0))    {        document.forms[0].submit();        document.all.chatWord.value='';        document.all.chatWord.focus();    }    }</script>
姓名:说:
//后边这个是提交信息的,并且我怎么写最后输出到chat.txt的除了“对”“说”别的文字全是乱码
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn