小编Mar*_*Tan的帖子

设置 Date 对象的时区

我目前正在尝试开发一个倒数计时器页面。这是倒数计时器代码:

var clock;

$(document).ready(function() {

    // Grab the current date
    var currentDate = new Date();

    // Set some date in the future. In this case, it's always Jan 1
    var futureDate = new Date("July 01, 2015 22:00:00");

    // Calculate the difference in seconds between the future and current date
    var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;

    if(diff < 0){
        // Instantiate a countdown FlipClock
        clock = $('.clock').FlipClock(0, {
            clockFace: 'DailyCounter',
            countdown: true
        });
        $('.message').html('Lets Go!!');
        $('.Go').removeAttr("disabled");
        $( …
Run Code Online (Sandbox Code Playgroud)

javascript timezone date

5
推荐指数
1
解决办法
2万
查看次数

.ajaxComplete无法正常工作

嗨,我目前遇到触发.ajaxComplete函数的问题,它应该在一个演示网站上工作.我在这里参考这个函数http://www.bitrepository.com/a-simple-ajax-username-availability-checker.html

这是我的代码:

    <SCRIPT type="text/javascript">
<!--
/*
Credits: Bit Repository
Source: http://www.bitrepository.com/web-programming/ajax/username-checker.html 
*/

pic1 = new Image(16, 16); 
pic1.src = "loader.gif";

$(document).ready(function(){

$("#userID").change(function() { 

var usr = $("#userID").val();

if(usr.length >= 4)
{
$("#status").html('<img src="loader.gif" align="absmiddle">&nbsp;Checking availability...');

    $.ajax({  
    type: "POST",  
    url: "check.php",  
    data: "userID="+ usr,  
    success: function(msg){  
   $("#status").ajaxComplete(function(event, request, settings){ 

    if(msg == "OK")
    { 

        $("#userID").removeClass('object_error'); // if necessary
        $("#userID").addClass("object_ok");
        $(this).html('&nbsp;<img src="tick.gif" align="absmiddle">');
    }  
    else  
    {  
        $("#userID").removeClass('object_ok'); // if necessary
        $("#userID").addClass("object_error");
        $(this).html(msg);
    }  

   });

 } 

  }); 

}
else
    {
    $("#status").html('<font color="red">The username …
Run Code Online (Sandbox Code Playgroud)

javascript ajax

2
推荐指数
1
解决办法
3335
查看次数

标签 统计

javascript ×2

ajax ×1

date ×1

timezone ×1