1.添加弹窗的具体步骤:
$(document).ready(function(){ $('#task_detail').dialog({ title:'任务详情', width:450, height:360, modal:true, closeText:'关闭', modal:true, resizable:false, autoOpen:false, buttons:{ '退出':function(){ $(this).dialog('close'); } } }); $('#list').click(function(){ $('#task_detail').dialog('open'); }); });
首先新建一个窗体设置它的属性,发现dialog里面是一个json格式的样式,可以设置一下他的属性一些基本的功能
下面是点击list的id就可以触发这个弹窗让他显示出来。
<div id="list"></div>
2.设置时间格式问题
譬如我想要获取的是当前的时间,然后将其转化为“yyyy-mm-dd”的形式就要写如下的函数进行修改:
Date.prototype.Format = function(fmt){ var o = { "M+" : this.getMonth()+1, //月份 "d+" : this.getDate(), //日 "h+" : this.getHours(), //小时 "m+" : this.getMinutes(), //分 "s+" : this.getSeconds(), //秒 "q+" : Math.floor((this.getMonth()+3)/3), //季度 "S" : this.getMilliseconds() //毫秒 }; if(/(y+)/.test(fmt)) fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); for(var k in o) if(new RegExp("("+ k +")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); return fmt; }
写完方法开始使用这个方法:
var logTime=new Date().Format("yyyy-MM-dd");