Form form Action Submission JS part and HTML part _javascript skill

Source: Internet
Author: User
1, JS part of the Code
Copy Code code as follows:

/**
* Submitting Form
*/
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 ()//check whether the entry is empty
} ,
Success:function (data) {
if (data = = "Success") {
$.messager.alert (' Hint ', ' <br> log published successfully! ', ' info ');
}else{

$.messager.alert (' Hint ', ' <br> log publish failed! ', ' warning ');
}
}
});
}
/**
* Post Log
*/
function Publishblog () {
SubmitForm ("http://localhost:8090/webplus3/_web/sns/createBlog.do?_p=YXM9Mw__", "Publish", "Log", "FM1", "publish");
}

2, HTML part
Copy Code code as follows:

<form style= "padding:10px 8px;" method= "Post" action= "" id= "FM1" name= "FM1" >
<div style= "margin-bottom:10px;" >
<span style= "padding-right:10px;" > Title:</span>
<input type= "text" id= "title" Name= "Blog.title" class= "Int_txt" maxlength= ">"
</div>
<div style= "margin-bottom:10px;" >
<span style= "padding-right:10px;" > Content:</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= "Publish Log (Ctrl+enter)" id= "SaveBlogButton "Onclick=" Publishblog () >
<span> Publishing </span>
</button>
</form>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.