Jav*_*ing 12 javascript css jquery
我是jQuery的新手.使用jQuery时,我断开了Internet连接以检查我的网页是否在没有Internet连接的情况下正常工作.它显示了一些不需要的东西.当我看到源代码时,它显示:
<link rel="stylesheet" href="http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
Run Code Online (Sandbox Code Playgroud)
所以我下载了代码并将其保存在我的根文件夹中.它仍然运作不佳.我想知道我们是否可以在离线时使用jQuery?
这是我的代码:
<!doctype html>
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> Home</title>
<meta name="author" content="jQuery Foundation - jquery.org">
<meta name="description" content="jQuery: The Write Less, Do More, JavaScript Library">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
<script src="jquery.min.js"></script>
<!--[if lt IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css"><![endif]-->
<script>try{Typekit.load();}catch(e){}</script>
<meta name="generator" content="WordPress 3.5.1" />
</head>
<body >
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser.
<a href="http://browsehappy.com/">Upgrade your browser today</a>
or <a href="http://www.google.com/chromeframe/?redirect=true">install
Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<header>
<section id="global-nav">
<nav>
<div class="constrain">
<ul class="links">
<li><a href="home.jsp">Home</a></li>
<li class="dropdown"><a href="CreatPatient.jsp">Patient</a>
<ul>
<li><a href="CreatePatient.jsp">Create Patient</a></li>
<li><a href="Edit Patient">Edit Patient</a></li>
</ul>
</li>
<li class="dropdown"><a href="Appointments.jsp">Appointments</a>
<ul>
<li><a href="CreateAppointments.jsp">Create Appointments</a></li>
<li><a href="EditAppointments.jsp/">Edit Appointments</a></li>
</ul>
</li>
<li class="dropdown"><a href="#">Reports</a>
<ul>
<li><a href="PreOperative.jsp">Pre Operative</a></li>
<li><a href="IntraOperative.jsp">Intra Operative</a></li>
<li><a href="PostOperative.jsp">PostOperative</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</section>
</header>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当我删除此行时:
<link rel="stylesheet" href="http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
Run Code Online (Sandbox Code Playgroud)
它造成了一个问题.
我已经下载了jQuery并保存在桌面上.HTML文件也在桌面上.请告诉我为什么它不起作用.
Alb*_*ing 17
是的,这是可能的.您已经提到您下载了文件 - 这是一个很好的第一步,但您还必须更改所有href和src引用.
例如,
<link rel="stylesheet" href="http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
Run Code Online (Sandbox Code Playgroud)
应该成为
<link rel="stylesheet" href="base.css">
Run Code Online (Sandbox Code Playgroud)
还要记得获取jQuery JS库的离线版本:
下载jquery.js,将其放在根文件夹中并引用它:
<script src="jquery-1.9.1.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
如果你想在子目录中:
<script src="[subdirectory-name]/jquery-1.9.1.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
请记住,这两个文件都需要脱机并位于工作的本地目录中.这意味着您无法删除样式表或 jQuery JS库.以我上面提到的本地格式保留它们.
另外,将<script>标签放入其中<head>是不好的做法; </body>改为在标签之前移动它.
你的代码现在应该看起来(简而言之,请注意我没有放多少)像:
...
<html class="no-js" lang="en-US">
<head>
...
<link rel="stylesheet" href="base.css">
...
</head>
<body>
...
<script src="jquery.min.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
再次,确保base.css和jquery.min.js是确切的文件名,并在同一文件夹这个.html文件
| 归档时间: |
|
| 查看次数: |
31626 次 |
| 最近记录: |