简单提交问题不知道为什么?

kisslan 2008-09-17 12:17:17



我这样提交没错误
<form name="form1" action="xxx" method="post" enctype="multipart/form-data" >






然后换到用js提交,就不提交到目标页面了!而是点提交就刷新本页面!不知道是什么问题啊?

<form name="form1" action="" method="post" enctype="multipart/form-data" >

<script>
function sub(url){
document.form1.aciton = url;
document.form1.submit();
}
</script>
<input type="button" name="button" onclick="return sub('xxx')"/> 
...全文
185 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
gs6fox 2008-09-17
  • 打赏
  • 举报
回复
楼主action写错了......
orz_ORZ_orz 2008-09-17
  • 打赏
  • 举报
回复
你写的是:document.form1.aciton = url;
orz_ORZ_orz 2008-09-17
  • 打赏
  • 举报
回复
你的action写错了。。。


<script>
function sub1(url){
document.form1.action = url;
document.form1.submit();

}
</script>
<form name="form1" method="post">

<input type="button" name="button" onclick="return sub1('aa.asp')"/>
</form>
  • 打赏
  • 举报
回复
<input type="button" name="button" onclick="return sub('xxx')"/
红色部分用的是return 所以出现了你说的情况
s_liangchao1s 2008-09-17
  • 打赏
  • 举报
回复

<script>
function sub(url){
document.form1.aciton = url;
document.form1.submit();
return true;//-------
}
</script>

cloudgamer 2008-09-17
  • 打赏
  • 举报
回复

aciton
llddy 2008-09-17
  • 打赏
  • 举报
回复

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1 </title>

<script>
function sub(url)
{
document.form1.action = url;
document.form1.submit();

}
</script>
</head>

<body>
<form name="form1" action="" method="post" enctype="multipart/form-data" >
<input type="button" name="button" onclick="sub('http://www.baidu.com');return false;"/> 
</form>

</body>

</html>

sallay 2008-09-17
  • 打赏
  • 举报
回复
1. document.form1.aciton = url; ----> document.form1.action = url;

2. 少了</form>
sallay 2008-09-17
  • 打赏
  • 举报
回复
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>

<script>
function sub(url)
{
document.form1.action = url;
document.form1.submit();

}
</script>
</head>

<body>
<form name="form1" action="" method="post" enctype="multipart/form-data" >
<input type="button" name="button" onclick="return sub('http://www.baidu.com')"/> 
</form>

</body>

</html>
cgisir 2008-09-17
  • 打赏
  • 举报
回复
同楼上
onclick="sub('xxx')"/>
ziming1019 2008-09-17
  • 打赏
  • 举报
回复
return 去掉

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧