在火狐浏览器中怎么用JS提交表单

因为用图片做的按钮比较好看所以就用JS提交表单(兼容火狐浏览器)

第1个回答  2013-07-16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>javascript</title>
<script language="javascript" type="text/javascript">
<!--alert("123456");
//var x=parseInt(prompt("请出示您的价格","1"));
//var y=10;
//document.write(z);
//var z=x+y;
function aa()
{ var a=form1.textfield1.value;
var b=form1.textfield2.value;
if(a!=""&&b!="")
{
var c=parseFloat(a)*parseInt(b);
var pay=parseInt(form1.se.value);
var grade;
switch(pay)
{
case 1:
grade=0.6;
break;
case 2:
grade=0.7;
break;
case 3:
grade=0.8;
break;
default:
alert("请重新选择支付方式");
break;
}
var sum=c*grade;
form1.textfield3.value=sum;
alert("您已享受"+grade*10+"折的优惠");
if(sum>10&&sum<=50)
{
alert("您的费用超过10元,送1QB,请注意查收!");
}
else if(sum>50&&sum<=100)
{
alert("您的费用超过50元,送5QB,请注意查收!");
}
else if(sum>100)
{
alert("您的费用超过100元,送10QB,请注意查收!");
}
else
{
alert("您的费用没超过10元,不送QB哦!");
}
}
else
{
alert("不能为空!");
}
}
-->
</script>
</head>
<body><form id="form1" name="form1" method="post" action="">
<marquee direction="left" scrollamount="10"
onmouseover="this.stop()" onmouseout ="this.start()">
<font size="24" face="楷体" color="green">
欢迎购物
</font>
</marquee>
<table width="480" height="233" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>数量:</td>
<td>
<label>
<input type="text" name="textfield1" />
</label>
</td>
</tr>
<tr>
<td><p>价格:</p>
<p>支付方式:</p>
</td>
<td><label>
<input type="text" name="textfield2" />

<select name="se">
<option>请选择支付方式:</option>
<option value="1">银行</option>
<option value="2">电话</option>
<option value="3">qb</option>
</select>
</label></td>
</tr>
<tr>
<td>总价:</td>
<td><label>
<input type="text" name="textfield3" />
</label></td>
</tr>
<tr>
<td>计算:</td>
<td><label>
<input type="button" name="Submit" value="提交" onclick="aa()"/>
</label></td>
</tr>
</table></form>
</body>
</html>
第2个回答  2014-03-07
  您好!很高兴为您答疑!

  使用下面这个代码即可:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="rForm" action="?">
<input type="button" value="Submit" onclick="subIt()" />
</form>
</body>
</html>
<script type="text/javascript">
function subIt(){
document.getElementById("rForm").submit();
}
</script>

  您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。本回答被网友采纳
第3个回答  2013-07-16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<form id="rForm" action="?">
<input type="button" value="Submit" onclick="subIt()" />
</form>
</body>
</html>
<script type="text/javascript">
function subIt(){
document.getElementById("rForm").submit();
}
</script> IE6 7 8,火狐都可以成功提交表单.本回答被网友采纳
第4个回答  2013-07-16
代码发出来啊。。。。
相似回答