第一种:在一般情况下按钮提交表单
<form name="form1" method="post" action="index.html">
<input type="submit" name="button" id="button" value="提交" />
</form>
这样提交按钮是标签 <input type="submit">,如果想换成图片加上样式,把value="提交" 改成value=" "(这样“提交”两个
字就不会显示在这张背景图片的上面):
#button{
background:url(eeo_2.jpg) no-repeat;
width:100px;
height:50px;
border:0px;
}
第二种:其他情况下按钮提交表单
<form name="form1" method="post" action="index.html">
<input type="button" value="提交" onclick="location='index.html'"/>
</form>
当表单没有input标签将表单内容传递给下一个页面时,就可以通过标签<input type="button">
第三种:直接使用图片标签按钮
<form name="form1" method="post" action="index.html">
<input name="submit" type="image" value="提交" src="eeo_2.jpg" />
</form>
这样子在html页面上就能直接看到按钮是图片
第四种:<button> 标签
<button type="button" onclick="location='index.html'">提交</button>
在 button 元素内部,可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。<button>
控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容
都是按钮的内容。请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规
范)的默认值是 "submit"。
<form name="form1" method="post" action="index.html">
<input type="submit" name="button" id="button" value="提交" />
</form>
这样提交按钮是标签 <input type="submit">,如果想换成图片加上样式,把value="提交" 改成value=" "(这样“提交”两个
字就不会显示在这张背景图片的上面):
#button{
background:url(eeo_2.jpg) no-repeat;
width:100px;
height:50px;
border:0px;
}
第二种:其他情况下按钮提交表单
<form name="form1" method="post" action="index.html">
<input type="button" value="提交" onclick="location='index.html'"/>
</form>
当表单没有input标签将表单内容传递给下一个页面时,就可以通过标签<input type="button">
第三种:直接使用图片标签按钮
<form name="form1" method="post" action="index.html">
<input name="submit" type="image" value="提交" src="eeo_2.jpg" />
</form>
这样子在html页面上就能直接看到按钮是图片
第四种:<button> 标签
<button type="button" onclick="location='index.html'">提交</button>
在 button 元素内部,可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。<button>
控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容
都是按钮的内容。请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规
范)的默认值是 "submit"。