1、用圖片代替提交和重置按鈕,給圖片加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>
2、給1的圖片加上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>