现在的位置: 首页 > 综合 > 正文

jQuery运行不了

2018年06月08日 ⁄ 综合 ⁄ 共 1364字 ⁄ 字号 评论关闭

很莫名其妙昨天写的jQuery简单例子,今天就不能正常运行

 

代码如下

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
  <head>
    <title>index4.html</title>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
 
 <script src="jquery-2.0.0.js" type="text/javascript"></script>
 
 <!-- <script src="jquery-2.0.0.js" type="text/javascript"></script> -->
 <!-- <script src="http://code.jquery.com/jquery-latest.js"></script> -->
 <!-- Creating and Removing Elements -->
  <!-- console.log(i); println -->
 <script type="text/javascript">
    $(function(){
      var i = $('li').size()+1;
       $('a#add').click(function(){
          $('<li>'+i+'</li>').appendTo('ul');
          i++;
       });
      
       $('a#remove').click(function(){
         $('li:last').remove();
         if (i != 0){  
           i--;
         }
       });
    });
 
 </script>
  </head>
  <body>
    <ul>
     <li>1</li>
     <li>2</li>
     <li>3</li>
     <li>4</li>
    </ul>
    <a href="#" id="add">Add List Item</a><br>
    <a href="#" id="remove">Remove List Item</a>
  </body>
</html>

 

在网上查询结果

大体三类:

1)直接在浏览器中运行jQuery的路径,看会不会出现下载的提示信息;

2)换成<script src="http://code.jquery.com/jquery-latest.js"></script>能不能正常;

3)操作系统;

 

第1,2点,测试后都是正常的;

对于第3点呢,我用的是XP系统,一直都是用的这个系统;

 

搞不明白,一个jQuery就会出现这些莫名其妙的问题?

 

 晕死,就没人知道?

抱歉!评论已关闭.