计时器结束时显示链接

时间:2014-12-26 14:58:55

标签: jquery

我已经放了一个计时器,我希望当计时器结束时,网页会显示一个链接以及一条消息“此优惠已过期。订阅当我们再次收到此优惠时会收到通知或点击此按钮以利用我们的其他优惠“。

<script>
function doneHandler(result) {

  var output = "This offer has expired. Subscribe to be notified when we have this offer again or Click the button below to take advantage of our other offers"

  alert(output);
}
var myCountdownTest = new Countdown({
                  time: 3,
                  width : 300, 
                  height  : 50,
                  onComplete : doneHandler
                  });
</script>

1 个答案:

答案 0 :(得分:0)

你会做这样的事情:

<body>

   <!-- all your other HTML -->

   <div id="subscribeOffer" style="display: none;">
       <h3>This offer has expired!</h3>
       <p>
           Subscribe to be notified when we have this offer again or 
           <a href="http://somewhere.com">click here</a>
           to take advantage of our other offers.
       </p>
   </div>

   <script>

       function doneHandler ( result ) 
       {
           // If you are using just plain JavaScript, you would do:
           document.getElementById("subscribeOffer").style.display = "block";

          // or if you have jQuery, comment out the above and uncomment the below:
          // $("#subscribeOffer").show();
        }

        var myCountdownTest = new Countdown
        ({
            time: 3,
            width: 300, 
            height: 50,
            onComplete: doneHandler
        });

    </script>

</body>