日期:2014-05-17  浏览次数:20865 次

多个文字来提交同一个表单,能做到吗?
不想用按钮,想用文字来提交同一个表单,但是对这个表单又有多种操作,比如“删除”、“全设为禁用”之类的,能够用文字来完成多个按钮的提交任务吗?
我的需求格式如下:

<form   name= "myform "   action= "edit.asp "   method= "post ">
<input   text......................
多个input>
</form>

<a   herf= " ">   删除 </a>
<a   herf= " ">   禁用 </a>
<a   herf= " ">   启用 </a>


现在就是后面三行代码不会,处理页面   edit.asp应该如何判断是哪一种操作呀?

------解决方案--------------------
<form name= "myform " action= "edit.asp " method= "post ">
<input text......................
多个input>
<input type=hidden name=x />
</form>

<a herf= " " onclick= "document.myform.x.value= '删除 ';document.myform.submit();return false "> 删除 </a>
<a herf= " " onclick= "document.myform.x.value= '禁用 ';document.myform.submit();return false "> 禁用 </a>
<a herf= " "> 启用 </a>
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script language= "javascript ">
function submitForm(action){
var objForm = document.getElementById( "myForm ");
objForm.action = "edit.asp?Action= " + action;
alert(objForm.action);
objForm.submit();
}
</script>
</HEAD>

<BODY>

<form name= "myform " action= "edit.asp " method= "post ">
<input text......................
多个input>
</form>
<a href= " " OnClick= "submitForm( 'del ') "> 删除 </a>
<a href= " " OnClick= "submitForm( 'close ') "> 禁用 </a>
<a href= " " OnClick= "submitForm( 'open ') "> 启用 </a>
</BODY>
</HTML>