当没有Internet连接时使用jQuery [英] Working with jQuery when there is no Internet connection
问题描述
我对jQuery完全陌生。当使用jQuery时,我断开了互联网,以检查我的网页是否正常没有互联网连接。它显示了一些不是必需的东西。当我看到源代码,它显示:
< link rel =stylesheethref =http:// jquery .com / jquery-wp-content / themes / jquery / css / base.css?v = 1>
所以我下载了代码并保存在我的根文件夹中。仍然不工作。我想知道我们是否可以在离线时使用jQuery?
这是我的代码:
<!doctype html>
<! - [if IE 7]> < html class =no-js ie ie7 lte7 lte8 lte9lang =zh-CN> <![endif] - >
<! - [if IE 8]> < html class =no-js ie ie8 lte8 lte9lang =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-jslang =en-US> <! - <![endif] - >
< head>
< meta charset =utf-8>
< meta http-equiv =X-UA-Compatiblecontent =IE = border,chrome = 1>
< title>首页< / title>
< meta name =authorcontent =jQuery Foundation - jquery.org>
< meta name =descriptioncontent =jQuery:The Write Less,Do More,JavaScript Library>
< meta name =viewportcontent =width = device-width>
< link rel =stylesheethref =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 =stylesheethref =css / font-awesome-ie7.min.css><![endif] - >
< script> try {Typekit.load();} catch(e){}< / script>
< meta name =generatorcontent =WordPress 3.5.1/>
< / head>
< body>
<! - [if lt IE 7]>
< p class =chromeframe>您使用的是过时的浏览器。
< a href =http://browsehappy.com/>立即升级您的浏览器< / a>
或< a href =http://www.google.com/chromeframe/?redirect=true>安装
Google Chrome内嵌框架< / a>以更好地体验此网站。< / p>
<![endif] - >
< header>
< section id =global-nav>
< nav>
< div class =constrain>
< ul class =links>
< li>< a href =home.jsp>首页< / a>< / li>
< li class =dropdown>< a href =CreatPatient.jsp> Patient< / a>
< ul>
< li>< a href =CreatePatient.jsp>创建患者< / a>< / li>
< li>< a href =编辑患者>编辑患者< / a>< / li>
< / ul>
< / li>
< li class =dropdown>< a href =Appointments.jsp>约会< / a>
< ul>
< li>< a href =CreateAppointments.jsp>创建约会< / a>< / li>
< li>< a href =EditAppointments.jsp />编辑约会< / a>< / li>
< / ul>
< / li>
< li class =dropdown>< a href =#>报告< / 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>
当我删除此行时:
< link rel =stylesheethref =http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1>
这会产生问题。
已下载jQuery并保留在桌面上。 HTML文件也在桌面上。请告诉我为什么它不工作。
是的,这是可能的。你提到你下载的文件 - 这是一个好的第一步,但你还必须改变所有的 href
和 src
参考。
例如,
< link rel =stylesheethref =http://jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1>
应为
< link rel =stylesheethref =base.css>
还要记住获取离线版本的jQuery JS库:
下载 jquery.js ,将其放入你的根文件夹&参考:
< script src =jquery-1.9.1.min.js>< / script>
如果您想在子目录中使用它:
< script src =[subdirectory-name] /jquery-1.9.1.min.js< / script>
请记住 >需要离线和在您的工作本地目录。这意味着您不能删除样式表或 jQuery JS库。
此外,将< script>
标签在< head>
是不好的做法;