当前位置:K88软件开发文章中心编程语言Css/Css3Css/Css301 → 文章内容

回车进行提交表单信息

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:49:31

常用的地方是:按回车进行提交表单信息,和点击按纽的效果是一样的。
<
form 
name="
form1"
 
method="
post"
 
action="
"
>

 
 
<
input 
type="
text"
 
name="
username"
>
<
br>

 
 
<
input 
type="
button"
 
value="
点击"
 
onclick="
javascript:s2()"
>

 
 
<
/form>

 
 
<
script>
 

document.onkeydown=function()
{ss()} 

function 
ss() 




if(event.keyCode==13) 




alert(form1.username.value)
 





function 
s2()

{
 
alert(form1.username.value)

}
<
/script>


回车进行提交表单信息