js提交表单
<script type="text/javascript" language="javascript">
function submitYouFrom(path){
$('form1').action=path;
$('form1').submit();
}
</script>
<form action="?" name="form1" id="form1">
<!-- 表单内容 -->
<input type="button" value="提交1" onclick="submitYouFrom('地址一')"/>
<input type="button" value="提交2" onclick="submitYouFrom('地址二')"/>
</form>
自己的代码:
<script type="text/javascript">
var url;
function show(id) {
var alter = document.getElementById("alter");
alter.style.display = "block";
url="photo?status=up_alname&id="+id;
}
function hide() {
var alter = document.getElementById("alter");
alter.style.display = "none";
}
function show1() {
var Delete = document.getElementById("delete");
Delete.style.display = "block";
}
function hide1() {
var Delete = document.getElementById("delete");
Delete.style.display = "none";
}
function submitData(){
document.getElementById("form3").action=url;
document.getElementById("form3").submit();
}
</script>
表单:
<form id="form3" class="form3" method="post" action="#">
<div id="alter" >
<div class="title">编辑相册
</div>
<div class="inform">
<p >相册名称</p>
<input type="text" id="name" name="album_name"/>
</div>
<div class="inform">
<p> 相册描述</p>
<textarea type="password" id="describe" name="describe" placeholder="说说这个相册的故事……(非必填)"></textarea>
</div>
<input id="cancle" type="reset" value="取消" onclick="javascript:hide();"/></a>
<input id="log" type="button" value="确定" onclick="submitData();"/>
</div>
</form>