试图让jquery倒计时工作,但它没有工作

时间:2013-10-18 16:37:43

标签: javascript jquery html css

html文件:

    // <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Coming Soon</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link href="tools/style.css" rel="stylesheet" type="text/css" />
    <link href="tools/jquery.countdown.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="tools/jquery.min.js"></script>
    <script type="text/javascript" src="tools/jquery.countdown.js"></script>
    <!-- <script type="text/javascript" src="tools/bg.js"></script> -->
    <script type="text/javascript">
$(function () {
var austDay = new Date();
austDay = new Date(2013, 10, 18, 12, 00);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
    });

    $(function(){
    $('.fadein img:gt(0)').hide();
    setInterval(function(){
      $('.fadein :first-child').fadeOut(3000)
     .next('img').fadeIn(3000)
     .end().appendTo('.fadein');}, 
      3000); // change this to change the transition timing
  });
    </script>
    </head>
    <body>
    <div id="shim"></div>
    <div class="fadein">
    <img src="images/photo1.jpg">
    <img src="images/photo2.jpg">
<img src="images/photo3.jpg">
<img src="images/photo4.jpg">
<img src="images/photo5.jpg">
    </div>
    <div id="content">
    <div class="logo"><h1>Sva Spa and Salon</span></h1></div>   
<div class="right_side">
    <div class="right_content">
        <h2>Watch For Our Brand New Website</h2>
        <div id="defaultCountdown"></div>
        <form class="email" action="">
            <input class="get_notified" type="text"     
    onfocus="if(this.value=='Provide EMAIL for Reminder') this.value='';"        
    onblur="if(this.value=='' || this.value==' ') this.value='Provide EMAIL for   
    Reminder';"     
    value="Provide EMAIL for Reminder"/>
            <input type="button" class="go" />
        </form>
    </div>
</div>
    </div>

    </body>
    </html>

我会让图像旋转以及计数器的文本出现,但只有当我刷新页面时它才会减少。另外我想为提交按钮添加一个php代码,将电子邮件地址发送到另一个电子邮件地址,我该怎么办呢?请帮助我卡住....

1 个答案:

答案 0 :(得分:0)

三件事:

  1. ID year没有任何内容,这是故意的吗?
  2. 倒计时should working good,但调试其余代码是你的工作
  3. 将您的代码放在.ready()函数
  4. 代码:

     $(document).ready(function() {
       //your code
     });