1、用type="image",其实就相当于用<IMG>标签,直接加字是加不了的,你可以试试加在图片里,或是用层来解决. 还可以用type="button"然后直接加字,图片用style="background-image:url('图片地址');"这样来处理.
2、<input type="submit" value="这是个提交按钮" style="width:100; height:100px; background-image:url('图片地址');">
3、用图片代替提交按钮submit和重置按钮reset,给图片加onclick事件
<script language="javascript"> function fsubmit(obj){ obj.submit(); } function freset(obj){ obj.reset(); } </script> <form id="form1" name="form1" method="post" action="login.asp"> 姓名: <input type="text" name="textfield" /> <img src="uploads/200707/30_145425_001.jpg" onClick="javascript:fsubmit(document.form1);"> <img src="uploads/200707/30_145428_002.jpg" onClick="javascript:freset(document.form1);"> </form> 4、给3的图片加上style,用于弥补方法1鼠标移到图片上无反应,未能给客户好的浏览体验 <script language="javascript"> function fsubmit(obj){ obj.submit(); } function freset(obj){ obj.reset(); } </script> <form id="form1" name="form1" method="post" action="login.asp"> 姓名: <input type="text" name="textfield" /> <img src="uploads/200707/30_145425_001.jpg" style="cursor:hand;" onClick="javascript:fsubmit(document.form1);"> <img src="uploads/200707/30_145428_002.jpg" style="cursor:hand;" onClick="javascript:freset(document.form1);"> </form> 5、用图片代替提交按钮submit和重置按钮reset,并加上链接,效果同4<script language="javascript">
function fsubmit(obj){ obj.submit(); } function freset(obj){ obj.reset(); } </script> <form id="form1" name="form1" method="post" action="login.asp"> 姓名: <input type="text" name="textfield" /> <a href="javascript:fsubmit(document.form1);"><img src="uploads/200707/30_145425_001.jpg" border="0" /></a> <a href="javascript:freset(document.form1);"><img src="uploads/200707/30_145428_002.jpg" border="0" /></a> </form>6、使用图像域。由于默认图像域点击时都是提交表单,因而要进行适当的处理: <script language="javascript"> function fsubmit(obj){ obj.submit(); } function freset(obj){ obj.reset(); } </script> <form id="form1" name="form1" method="post" action="login.asp"> 姓名: <input type="text" name="textfield" /> <input type="image" name="imageField" onClick="javascript:fsubmit(document.form1);return false;" src="uploads/200707/30_145425_001.jpg"> <input type="image" name="imageField2" onClick="javascript:freset(document.form1);return false;" src="uploads/200707/30_145428_002.jpg"> </form> 要注意的是JS中表单提交和重置事件后必须加(),如submit()和reset() 7:使用如下方法: <script language="javascript"> function fsubmit(){ var obj=document.getElementById('form1'); if (obj.username.value=='') { alert('请填写用户名'); return false; } } </script> <form id="form1" name="form1" method="post" action="login.asp" οnsubmit="return fsubmit()"> 姓名: <input type="text" name="username" /> <input type="image" src="../images/login.gif"> </form>