Javascript脚本没有加载?我做错了什么?

Javascript脚本没有加载?我做错了什么?,javascript,load,Javascript,Load,大家好,我在玩javascript,试图创建一个倒计时计时器!但是我认为head部分中的javascript不会加载,因为即使是警告消息也不会显示!我是新手,伙计们,我做错了什么?还有,我怎样才能把我的变量放在html上,让它们显示出来呢?谢谢你的时间。。。这是我的代码: <html> <head> <script type="text/javascript">

大家好,我在玩javascript,试图创建一个倒计时计时器!但是我认为head部分中的javascript不会加载,因为即使是警告消息也不会显示!我是新手,伙计们,我做错了什么?还有,我怎样才能把我的变量放在html上,让它们显示出来呢?谢谢你的时间。。。这是我的代码:

               <html>
              <head>
                 <script type="text/javascript">
                 alert("welcome");
                      function calc() {
                        var year,month,date,hour,minutes,seconds,temp ;
                        temp = new Date();
                        year = temp.getFullYear();
                        month = temp.getMonth();
                        date = temp.getDate();
                        hour = temp.getHours(); 
                        minutes = temp.getMinutes();
                        seconds = temp.getSeconds();


                       var thenyear,thenmonth,thendate,thenhour,thenminutes,thenseconds ;
                       var difyear,difmonth,difdate,difhour,difminutes,difseconds ;
                       thenyear = document.getElementById("year").value ;
                       thenmonth = document.getElementById("Month").value;
                       thendate = document.getElementById("date").value;
                       thenhour = document.getElementById("hour").value;
                        thenminutes = document.getElementById("min").value;
                       thenseconds = document.getElementById("sec").value;

                      difyear= thenyear - year ;
                      difmonth = thenmonth -month ;
                      difdate  = thendate - date ;
                       difhour = thenhour - hour;  
                       difminutes =thenminutes - minutes ;
                      difseconds = thensec - seconds ;
                 alert("Time Remaing": + difyear + "Years" + difmonth +" Months" + difhour + "Hours" + difminutes + "Minutes" + difseconds+ " Seconds");
            }


</script>
</head>
<body>
<p> Countdown Timer </p>
<form onsubmit="calc();">
Date/Month/Year 
<select id="date" name="date">
  <script type="text/javascript">

  for(var i = 1; i < 32; i++){
    document.write('<option value="'+i+'">'+i+'</option>');
  }
  </script>
</select>
<select id="Month" > 
<option value="1">January </option>
<option value="2">February </option>
<option value="3">March </option>
<option value="4">April </option>
<option value="5">May </option>
<option value="6">June </option>
<option value="7">July </option>
<option value="8">August </option>
<option value="9">September </option>
<option value="10">Octomber </option>
<option value="11">November </option>
<option value="12">December</option>
</select>
<select id="year" name="year">
  <script type="text/javascript">
  var myDate = new Date();
  var year = myDate.getFullYear();
  for(var i = year; i < 3001; i++){
    document.write('<option value="'+i+'">'+i+'</option>');
  }
  </script>
</select> <br>
Hour(0-23)/Minutes/Seconds

  <input type="text" id="hour"> 
  <input type="text" id="min">
  <input type="text" id="sec">
  <input type="submit" value="Submit">
</form>



</body>
</html>

警惕(“欢迎”);
函数计算(){
变量年、月、日、时、分、秒、温度;
临时=新日期();
年份=温度getFullYear();
month=temp.getMonth();
日期=临时获取日期();
小时=温度getHours();
分钟=临时获取分钟();
秒=临时获取秒();
变量依次为年、月、日、时、分、秒;
变量difyear、difmonth、difdate、difhour、difminutes、difseconds;
thenyear=document.getElementById(“年”).value;
thenmonth=document.getElementById(“月”).value;
thendate=document.getElementById(“日期”).value;
thenhour=document.getElementById(“hour”).value;
thenminutes=document.getElementById(“min”).value;
然后秒=document.getElementById(“秒”)值;
difyear=年份-年份;
difmonth=然后月份-月份;
difdate=thendate—日期;
difhour=小时-小时;
difminutes=分钟-分钟;
difseconds=n秒-秒;
警报(“时间重现”:+difyear+“年”+difmonth+“月”+difhour+“小时”+difminutes+“分钟”+difseconds+“秒”);
}
倒数计时器

日期/月/年 对于(变量i=1;i<32;i++){ 文件。写入(“”+i+“”); } 一月 二月 前进 四月 也许 六月 七月 八月 九月 十月 十一月 十二月 var myDate=新日期(); var year=myDate.getFullYear(); 对于(变量i=年;i<3001;i++){ 文件。写入(“”+i+“”); }
小时(0-23)/分/秒
您的浏览器控制台中是否有任何错误?我很快发现了一个错误-
alert(“Time Remaing”):
JSFIDLE可能会有所帮助!检查控制台中的错误,有时浏览器扩展会阻止警报。开发人员工具在开始时说我需要(我对其进行了更改,但仍然没有任何更改),并说明了以下内容:反向导航缓存:/