-1

我有一个 JS,我希望在 JS 过期日期过后,禁用该脚本。

如果没有前 3 行代码,脚本可以正常工作。我不确定前 3 行有什么问题。按照整个代码:

#include <date.au3>
$ExpirationDate = '9/18/2013'
If _NowDate() = $ExpirationDate Then MsgBox(64, 'Info:', "")

/* TOP 3 lines above - Javascript to stop working after a certain date */

var isloggedin = true;

function bozhoShow() {
    jQuery('&quot;div[id^=\&#39;bobito-button-wrapper\&#39;]&quot;').show();
}

function ggtimer() {
    if (isloggedin == false) {
        disableclicking();
    }
    jQuery(document).ready(function () {
        var testmode = 0;
        var dohidex = ' opacity: 0; filter: alpha(opacity = 0); ';
        if (testmode == true) {
            dohidex = '';
        }
        jQuery.get('functions.php?type=2', function (data) {
            if (data.length > 3) {
                //alert(data);
                disableclicking();
            } else {
                //alert(data);
            }
        });
4

2 回答 2

2

使用这样的东西:

if(new Date() > new Date('2013-09-18')){
    //expired
}else{
    //valid
}

在服务器端管理这样的东西可能会更好,所以我建议改用 PHP。

于 2013-08-22T08:10:04.280 回答
1
<?php
$date = strtotime("2013-08-22 12:00");
$now = time();
if($date<= $now)
{
   ?>
   <script>
   //YOUR JS SCRIPT
   </script>
   <?php
}
else
{
   ?>
   <script>
   //YOUR OTHER JS SCRIPT
   </script>
   <?php
}

?>

希望能帮助到你 :)

(这是 PHP 方法,因为您标记了 javascript 和 php)

于 2013-08-22T08:13:26.930 回答