随意输入一个开始日期,一个开始时间,一个结束日期和一个结束时间,
比如:开始日期:2008-10-7 开始时间:17:20 (这里的日期和时间都是可以随意选择的)
结束日期:2008-10-15 结束时间: 10:25
用Javascript语言该怎么实现??麻烦请帮帮我
比如:开始日期:2008-10-7 开始时间:17:20 (这里的日期和时间都是可以随意选择的)
结束日期:2008-10-15 结束时间: 10:25
用Javascript语言该怎么实现??麻烦请帮帮我
解决方案 »
- 获取页面图片
- js文档解析一个解决方法
- 建立一个DIV后 如何设置name
- 如何实现两个文框的粘贴
- 求教:javascript实现可编辑的图表
- setInterval 执行错误
- jsp如何实现2个table交互?如图所示
- 在javascript中在刚加载页面的时候就执行text清空!在线等,立即给分!
- 如何在一个页面载入时调用一个servlet?
- 如何察看<script language="JavaScript" src="/replets?op=resource&name=%2Futil.js"></script>中的源代码?
- 数据表中 的单选按钮问题
- 请帮忙把左侧的菜单滑动效果扣出来,或者给提供一个思路
function Calculation(){
this.oneday = 24*60*60*1000
this.onehour=60*60*1000
this.onemin=60*1000
this.onesecond=1000
if(typeof(Calculation.initialized)=="undefined")
{
Calculation.prototype.change=function(front,next){
var fronttime= new Date(front[0],front[1],front[2],front[3],front[4],front[5])
var nexttime= new Date(next[0],next[1],next[2],next[3],next[4],next[5])
var differ =nexttime.getTime()-fronttime.getTime()
var dday =parseInt(differ/this.oneday)
differ = differ-parseInt(differ/this.oneday)*(this.oneday)
var dhour =parseInt(differ/this.onehour)
differ = differ-parseInt(differ/this.onehour)*this.onehour
var dmin =parseInt(differ/this.onemin)
differ = differ-parseInt(differ/this.onemin)*this.onemin
var dsecond = differ/this.onesecond
return (dday+"天"+dhour+"时"+dmin+"分"+dsecond+"秒")
}
}
Calculation.initialized=true
}
var xx = new Calculation()
var a=[2001,8,12,18,15,11] //2001年9月12日 18:15:111
var b=[2008,11,11,11,11,11] //2008年11月11日 11:11:11
alert(xx.change(a,b))
刚学写类 写的很烂!~~~