form表单action提交的js部分与html部分
1、JS部分代码
2、html部分
代码如下:
/** * 提交表单 */ function submitForm(action, actName, objName, formName,blogType){ $("#"+formName).attr("action",action); //var f = document.getElementsByTagName("form")[0]; //alert(f.action); $("#"+formName).form({ onSubmit:function(){ checkInput();//检查输入项是否为空 } , success:function(data){ if (data == "success"){ $.messager.alert('提示','<br>日志发表成功!','info'); }else{ $.messager.alert('提示','<br>日志发表失败!','warning'); } } }); } /** * 发表日志 */ function publishBlog() { submitForm("http://localhost:8090/webplus3/_web/sns/createBlog.do?_p=YXM9Mw__","发表","日志","fm1","publish"); }
2、html部分
代码如下:
<form style="padding: 10px 8px;" method="post" action="" id="fm1" name="fm1"> <div style="margin-bottom: 10px;"> <span style="padding-right: 10px;">标题:</span> <input type="text" id="title" name="blog.title" class="int_txt" maxlength="30"> </div> <div style="margin-bottom: 10px;"> <span style="padding-right: 10px;">内容:</span> <input type="text" id="content" name="blog.content" class="int_txt" maxlength="3000"> </div> <button class="btnstyle-strong btn-submit btn-submit-2" type="submit" title="发表日志(ctrl+enter)" id="saveBlogButton" onclick="publishBlog()"> <span>发 表</span> </button> </form>
相关推荐
wcqwcq 2020-07-04
TONIYH 2020-06-11
yhginny 2020-04-20
nicepainkiller 2020-05-12
Lius 2020-05-05
longshengguoji 2020-02-13
ajaxtony 2020-02-03
HSdiana 2019-12-15
taiyanghua 2019-12-02
sunnyishere 2014-01-22
86580599 2019-09-23
shumark 2014-05-29
爱好HtmlCssJs 2019-10-28
shumark 2014-07-07
AngelicaA 2015-03-14
81751330 2015-03-10
kentrl 2016-05-03
Qc 2020-07-19
swiftwwj 2020-07-05