js form action动态修改方法
程序员文章站
2023-12-01 15:34:58
一般比较简单的就是document.formname.action="/dddd.do?ddd="+str document.formname.submit(); 写成函数...
一般比较简单的就是
document.formname.action="/dddd.do?ddd="+str
document.formname.submit();
写成函数式的调用就是
<script language="javascript" >
function checkaction(v){
if(v==0){
document.dbform.action="index.php?admin_db-repair";
}else{
document.dbform.action="index.php?admin_db-optimize";
}
dbform.submit();
}
</script>
<form action="" method="post" name="dbform">
<input type="submit" class="btn" value="{lang dbstartoptimize}" name="opsubmit" onclick="checkaction(1);" />
<input type="submit" class="btn" value="{lang dbstartfix}" name="resubmit" onclick="checkaction(0);" />
</form>
document.formname.action="/dddd.do?ddd="+str
document.formname.submit();
写成函数式的调用就是
复制代码 代码如下:
<script language="javascript" >
function checkaction(v){
if(v==0){
document.dbform.action="index.php?admin_db-repair";
}else{
document.dbform.action="index.php?admin_db-optimize";
}
dbform.submit();
}
</script>
<form action="" method="post" name="dbform">
<input type="submit" class="btn" value="{lang dbstartoptimize}" name="opsubmit" onclick="checkaction(1);" />
<input type="submit" class="btn" value="{lang dbstartfix}" name="resubmit" onclick="checkaction(0);" />
</form>