六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 61|回复: 0

INPUT type=image 自动提交表单

[复制链接]

升级  57.33%

38

主题

38

主题

38

主题

秀才

Rank: 2

积分
136
 楼主| 发表于 2013-2-7 15:04:47 | 显示全部楼层 |阅读模式
today when i write the system logon code,i write the code like :
 
<input type="image" tabindex="4" name="imageField" id="imageField"
        src="<%=baseURL %>/css/style/HCS_Style/image/HCS_Style/login2_04.gif"  />;
 
so the confusing thing come,when i click the image the form is automatically submit;
so the above code submit the form twice.
i check the html conference, i find a sentence like this:
"INPUT type=image 创建一个图像控件,该控件单击后将导致表单立即被提交。"
that is to say:Creates an image control that, when clicked, causes the form to be immediately submitted.
 
so you can write the logon code like below formats:
1.<img tabindex="4" name="imageField" id="imageField" src="<%=baseURL %>/css/style/HCS_Style/image/HCS_Style/login2_04.gif" style="cursor:hand"  >
2.<input type="image" tabindex="4" name="imageField" id="imageField"
        src="<%=baseURL %>/css/style/HCS_Style/image/HCS_Style/login2_04.gif"  />;
when you write the code like the second fomat,you must set the action to the form before the image is clicked.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表