-3

特定の日の午前 0 時までコンテンツを非表示にしたいと考えています。その後、特定のフォームに iframe を表示したいと考えています。これはどのように達成できますか?jQuery カウントダウン プラグインを何かと組み合わせて使用​​するのではないかと考えていました。

4

2 に答える 2

0

唯一の適切な解決策は、サーバー側でチェックを行うことです。タイマーを使用するものはすべて、クライアント側で(比較的)簡単に操作できるためです。

次のようなものにする必要があります (疑似コード)。

サーバー側スクリプト:

// normal stuff

if (servertime == your desired time){
      // include the special codez
      // It's probably best to have that iframe content in a separate file
      // and just import the file here
}

// more normal stuff
于 2013-01-17T13:30:09.910 に答える
0

クライアント側で行うことは、ユーザーから多くを隠すことはありません...

しかし、これはクライアント側の非常に基本的なアルゴリズムです...

function TestTime(reqTime) {
 var date=new Date();
 if(date.getHours()===reqTime.getHours() && date.getMinutes()===reqTime.getMinutes()) { // you may need to add other validations like date etc
   //on success either redirect to other page or show the hidden content 
   location.href=""//the redirected page may need to validate on server side
   $('div').show() // show content
} else {
  $('div').html('Some content'); //you can show counter kind of thing here
  window.setTimeout(TestTime, 1000, true);


}
}
于 2013-01-17T13:37:16.737 に答える