js前端代码如何写
1、/**
* 格式化日期
*/
function formatDate(value){
if(value!=null){
var date = new Date(value);
if( date.getHours() == 0)
return date.format("yyyy-MM-dd");
else
2、return date.format("yyyy-MM-dd hh:mm:ss");
}
return "";
}
Date.prototype.format = function(format){
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
3、"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
}
}
return format;
}
1、获取前端radio的值,并转换固定格式的str;
function getCheckBoxArray(domArray){
var s="";
$("#"+domArray).each(function(){
if($(this).prop('checked')==true){
s = s + $(this).val() + ",";
}
})
return s;
}
2、404数字是什么?
一 是服务器执行完客户端的请求以后,返回给客户端的一个执行结果的状态编码
产生的原因:Web服务器(容器)根据请求地址找不到对应资源。如:
① 地址错误(拼写不正确,字母大小写错误)
② web.xml文件中的两个<servlet-name>不一致
③ 工程没有部署
④ Web应用程序部署结构没有遵守Servlet规范
3、页面组建
<section id="form_section" >
<header>
<nav class="left">
<a href="#" data-icon="previous" data-target="back">Back</a>
</nav>
<h1 class="title">Form</h1>
</header>
<footer>
<a href="#form_module_article" class="active" data-target="article" data-icon="stack">组件</a>
<a href="#form_article" data-target="article" data-icon="list" >表单</a>
</footer>
4、 <article data-scroll="true" id="form_article" >
<div class="indented">
<!-- Input -->
<form>
<input type="date">
<input type="time">
<input type="month">
<input type="week">
<a class="button block" data-icon="cogs">保存</a>
</form>