我的提交按钮在div里,关于提交的问题 本帖最后由 vic90 于 2013-06-15 23:21:04 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 本人蠢办法: 用js动态加个name,value和button一样hidden类型表单元素 <script type="text/javascript"> function fun() { var newInput = document.createElement("input"); newInput.type = "hidden"; newInput.name = document.getElementById("sub").name; newInput.value = document.getElementById("sub").value; document.voteform.appendChild(newInput); document.voteform.submit(); } </script><form method="post" id="voteform" name="voteform" action="vote.php">.......<div><input type="button" id="sub" name="sub" value="sub"></div><input type="submit" onclick="fun()"></form> 没懂。只要是在form表单中,你管是在div层还是在span或者td层干嘛? <div><input type="button" id="sub" name="sub" value="sub"></div>提交按钮写错了 我的代码是这样的:<form method="post" id="voteform" name="voteform" action="vote.php" onSubmit="javascript:return check_input();" >.... <div style="text-align:center; padding-top:10px;"><a id="sub" name="sub" href="" onClick="check_input();return false;"/><img src="../style/tb03.gif"></a></div></form>提交按钮是一个图标,而check_input函数是这样的function check_input(){.....document.voteform.submit();},但是提交以后我想判断是否已经按下那个提交的图标,就像isset($_POST['sub']),应该如何操作? 我的代码是这样的:<form method="post" id="voteform" name="voteform" action="vote.php" onSubmit="javascript:return check_input();" >.... <div style="text-align:center; padding-top:10px;"><a id="sub" name="sub" href="" onClick="check_input();return false;"/><img src="../style/tb03.gif"></a></div></form>提交按钮是一个图标,而check_input函数是这样的function check_input(){.....document.voteform.submit();},但是提交以后我想判断是否已经按下那个提交的图标,就像isset($_POST['sub']),应该如何操作? <div style="text-align:center; padding-top:10px;"><input type=image src="../style/tb03.gif" name=sub></div>提交后 isset($_POST['sub_x']) $_POST['sub_x']后面的那个_x是什么意思啊? input type=image 提交时包含鼠标位置 input type=image 提交时包含鼠标位置 我print_r 了一下$_POST,发现里面有我的表单信息,但是并没有那个图片按钮的坐标啊啊 <form method="post" id="voteform" name="voteform" action="vote.php?id=<?php echo $_GET['id'] ?>&action=<?php echo $_SESSION['identity']?>&account=<?php echo $_SESSION['account']?>" onSubmit="return false;"><table width="96%" border="1" align="center" cellpadding="3" cellspacing="2"> <tr> <td align="center"><strong>1</strong></td> <td align="center"><strong>2</strong></td> <td align="center"><strong>3</strong></td> <td align="center"><strong>4</strong></td> </tr> <tr> <td align="center"><input type="radio" id="opt1" name="opt1" value="100" />100分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="100" />100分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="100" />100分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="100" />100分</td> </tr> <tr> <td align="center"><input type="radio" id="opt1" name="opt1" value="80" />80分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="80" />80分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="80" />80分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="80" />80分</td> </tr> <tr> <td align="center"><input type="radio" id="opt1" name="opt1" value="60" />60分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="60" />60分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="60" />60分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="60" />60分</td> </tr> <tr> <td align="center"><input type="radio" id="opt1" name="opt1" value="40" />40分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="40" />40分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="60" />60分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="60" />60分</td> </tr> </table> <div style="text-align:center; padding-top:10px;"><input type="image" src="../style/tb03.gif" name="sub" onClick="check_input();return false;"></div></form> 你是在 check_input 中用 submit 方法提交的?或是用 ajax 提交的?那就对不起了,你需要自行传值 我在check_input 里面是用submit提交的应该如何传啊?我只是一个菜鸟 <form method="post" id="voteform" name="voteform" action="vote.php?id=<?php echo $_GET['id'] ?>&action=<?php echo $_SESSION['identity']?>&account=<?php echo $_SESSION['account']?>" onSubmit="return check_input();"><input type="image" src="../style/tb03.gif" name="sub"> 通过svn获取了服务器的php站点后怎么配置整合到apache里面去了。 jpgraph PHP+DOM怎样修改包含在CDATA中的文本节点的值? 如何将文件传到另一个服务器上 调用http接口 出现的问题 aparche的设置问题? PHP接收表单 enctype类型 深圳急聘.net程序员 我是菜鸟实在搞不懂,这是什么原因? 谁有PHP产品发布和订购系统,相当于留言板一样的购物系统,要没有加密的,咱要.. 敬爱的版主请进!请教个问题 由浅到深学习PHP的编程与应用
用js动态加个name,value和button一样hidden类型表单元素
<script type="text/javascript">
function fun()
{
var newInput = document.createElement("input");
newInput.type = "hidden";
newInput.name = document.getElementById("sub").name;
newInput.value = document.getElementById("sub").value;
document.voteform.appendChild(newInput);
document.voteform.submit();
}
</script>
<form method="post" id="voteform" name="voteform" action="vote.php">
.......
<div><input type="button" id="sub" name="sub" value="sub"></div>
<input type="submit" onclick="fun()">
</form>
<form method="post" id="voteform" name="voteform" action="vote.php" onSubmit="javascript:return check_input();" >
....
<div style="text-align:center; padding-top:10px;"><a id="sub" name="sub" href="" onClick="check_input();return false;"/><img src="../style/tb03.gif"></a></div>
</form>
提交按钮是一个图标,而check_input函数是这样的
function check_input(){
.....
document.voteform.submit();
},但是提交以后我想判断是否已经按下那个提交的图标,就像isset($_POST['sub']),应该如何操作?
<form method="post" id="voteform" name="voteform" action="vote.php" onSubmit="javascript:return check_input();" >
....
<div style="text-align:center; padding-top:10px;"><a id="sub" name="sub" href="" onClick="check_input();return false;"/><img src="../style/tb03.gif"></a></div>
</form>
提交按钮是一个图标,而check_input函数是这样的
function check_input(){
.....
document.voteform.submit();
},但是提交以后我想判断是否已经按下那个提交的图标,就像isset($_POST['sub']),应该如何操作?
提交后 isset($_POST['sub_x'])
<table width="96%" border="1" align="center" cellpadding="3" cellspacing="2">
<tr>
<td align="center"><strong>1</strong></td>
<td align="center"><strong>2</strong></td>
<td align="center"><strong>3</strong></td>
<td align="center"><strong>4</strong></td>
</tr>
<tr>
<td align="center"><input type="radio" id="opt1" name="opt1" value="100" />100分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="100" />100分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="100" />100分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="100" />100分</td>
</tr>
<tr>
<td align="center"><input type="radio" id="opt1" name="opt1" value="80" />80分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="80" />80分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="80" />80分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="80" />80分</td>
</tr>
<tr>
<td align="center"><input type="radio" id="opt1" name="opt1" value="60" />60分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="60" />60分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="60" />60分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="60" />60分</td>
</tr>
<tr>
<td align="center"><input type="radio" id="opt1" name="opt1" value="40" />40分</td><td align="center"><input type="radio" id="opt2" name="opt2" value="40" />40分</td><td align="center"><input type="radio" id="opt3" name="opt3" value="60" />60分</td><td align="center"><input type="radio" id="opt4" name="opt4" value="60" />60分</td>
</tr>
</table> <div style="text-align:center; padding-top:10px;"><input type="image" src="../style/tb03.gif" name="sub" onClick="check_input();return false;"></div>
</form>
那就对不起了,你需要自行传值
<input type="image" src="../style/tb03.gif" name="sub">