发布于 2017-01-24 12:18:42 | 187 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Javascript教程,程序狗速度看过来!

JavaScript客户端脚本语言

Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。


大家对form表单的action提交有些了解吧,下面为大家介绍下实现的js部分与html部分,感兴趣的朋友可以参考下
1、JS部分代码
 
/** 
* 提交表单 
*/ 
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> 


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务