现在获取的是1970年1月1日代码为: <script type="text/javascript">
function showSelectTimeBox (id) {
var ele;
if(id&&document.getElementById(id)){
ele = document.getElementById(id);
}
else{
ele = document.getElementById('selectTimeBox');
}
if(ele.style.display == 'block') return;
ele.style.display = 'block';
var allHeight = ele.offsetHeight;
ele.style.height = '1px';
(function(){
if(ele.offsetHeight<allHeight){
ele.style.height = (parseInt(ele.style.height) + 20) +'px';
setTimeout(arguments.callee,20);
}
else{
ele.style.height = 'auto';
}
})();
}
//根据今天的日期初始化
(function(){
var serverTime = '{$flow_time}000';
var time = serverTime ? new Date(parseInt(serverTime)):new Date();
var month = time.getMonth()+1;
if(month.length==1) month = '0'+month;
var day = time.getDay();
var date = time.getDate();
var hour = time.getHours();
if(date<10) date = '0'+date; var html = '';
var number = ['日','一','二','三','四','五','六'];
for(var i=0; i<7; i++){
if(i==0){
html += '<ul>';
if(day==6||day==0){
html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
}
else{
html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
}
if(day==0){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
if(hour<1){
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else if(hour<13){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
}
html += '</ul>';
}
else{
html += '<ul>';
if(day==6||day==0){
html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
}
else{
html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
}
if(day==0){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
html += '</ul>';
} time.setDate(parseInt(date,10)+1);
month = time.getMonth()+1;
if(month<10) month = '0'+month;
day = time.getDay();
date = time.getDate();
if(date<10) date = '0'+date;
}
document.getElementById('selectTimeUlBox').innerHTML = html;
})();
//给所有a绑定点击函数
(function(){
var as = document.getElementById('selectTimeUlBox').getElementsByTagName('a');
function clearSelect(){
for(var i=0; i<as.length; i++){
if(as[i].className!='disabled'){
as[i].className = '';
}
}
}
for(var i=0; i<as.length; i++){
if(as[i].className != 'disabled'){
as[i].onclick = function(){
clearSelect();
this.className = 'selected';
document.getElementById('selectTimeP').innerHTML = this.title;
document.getElementById('best_time').value = this.title;
document.getElementById('selectTimeBox').style.display = 'none';
}
}
}
})();
document.body.onclick = function(e){
e = e || window.event;
var ele = e.target || e.srcElement;
var flag = false;
while(ele.parentNode != null){
if(ele.className=='mod_select'){
flag = true;
return;
}
ele = ele.parentNode;
}
if(!flag) {
document.getElementById('selectTimeBox').style.display = 'none';
}
}
</script>
javascript
function showSelectTimeBox (id) {
var ele;
if(id&&document.getElementById(id)){
ele = document.getElementById(id);
}
else{
ele = document.getElementById('selectTimeBox');
}
if(ele.style.display == 'block') return;
ele.style.display = 'block';
var allHeight = ele.offsetHeight;
ele.style.height = '1px';
(function(){
if(ele.offsetHeight<allHeight){
ele.style.height = (parseInt(ele.style.height) + 20) +'px';
setTimeout(arguments.callee,20);
}
else{
ele.style.height = 'auto';
}
})();
}
//根据今天的日期初始化
(function(){
var serverTime = '{$flow_time}000';
var time = serverTime ? new Date(parseInt(serverTime)):new Date();
var month = time.getMonth()+1;
if(month.length==1) month = '0'+month;
var day = time.getDay();
var date = time.getDate();
var hour = time.getHours();
if(date<10) date = '0'+date; var html = '';
var number = ['日','一','二','三','四','五','六'];
for(var i=0; i<7; i++){
if(i==0){
html += '<ul>';
if(day==6||day==0){
html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
}
else{
html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
}
if(day==0){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
if(hour<1){
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else if(hour<13){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
}
html += '</ul>';
}
else{
html += '<ul>';
if(day==6||day==0){
html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
}
else{
html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
}
if(day==0){
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
else{
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +' 傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
}
html += '</ul>';
} time.setDate(parseInt(date,10)+1);
month = time.getMonth()+1;
if(month<10) month = '0'+month;
day = time.getDay();
date = time.getDate();
if(date<10) date = '0'+date;
}
document.getElementById('selectTimeUlBox').innerHTML = html;
})();
//给所有a绑定点击函数
(function(){
var as = document.getElementById('selectTimeUlBox').getElementsByTagName('a');
function clearSelect(){
for(var i=0; i<as.length; i++){
if(as[i].className!='disabled'){
as[i].className = '';
}
}
}
for(var i=0; i<as.length; i++){
if(as[i].className != 'disabled'){
as[i].onclick = function(){
clearSelect();
this.className = 'selected';
document.getElementById('selectTimeP').innerHTML = this.title;
document.getElementById('best_time').value = this.title;
document.getElementById('selectTimeBox').style.display = 'none';
}
}
}
})();
document.body.onclick = function(e){
e = e || window.event;
var ele = e.target || e.srcElement;
var flag = false;
while(ele.parentNode != null){
if(ele.className=='mod_select'){
flag = true;
return;
}
ele = ele.parentNode;
}
if(!flag) {
document.getElementById('selectTimeBox').style.display = 'none';
}
}
</script>
javascript
解决方案 »
- 有关用js在两个页面传参数的问题~~~
- 急!!!
- 请问用javascrpit能够实现像鼠标和键盘一样操控网页的功能吗?
- javascrip 表格中每行有链接 如何判断
- 修改自梅花雪的日期控件。。呵呵小改动
- 页面自动提交代码!!
- HTML中显示的文字怎么自动换行(不是通过<br>来控制,而要其根据字体长度自动换行),请指教。
- 小女子 着急,大家帮帮忙!!!!!
- 固定宽度的瀑布流怎么实现呀?
- 老哥们 谁有js根据银行卡号判断银行的方法
- 怎样从一个html获取另一个html文件text的name或者id属性
- javascript 以document.write写html语句,其中的onclick事件无法触发?
new Date( 1380369419702 ) //是 1970 年 1 月 1 日午夜之间相间隔的毫秒数。
或者 new Date( '2013/9/28 00:00' )
你是意思是要取当前的后台时间?
ecshop 不了解,不过 PHP 可以
var serverTime = <?php echo time() ?>000000
<?php echo time() ?>000