Google Jquery CDN 官网介绍 引入google-jquery-cdn的方法如下:
方式一:
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
方式二:
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript"><!--
google.load("jquery", "1.7.1");
google.setOnLoadCallback(function() {
// Place init code here instead of $(document).ready()
});
// -->
</script>
如果Google Jquery CDN崩掉了,你可以调用本地的备用jQuery
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
document.write(unescape("%3Cscript src='Scripts/jquery.1.7.1.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
如果你想始终使用最新版的jQuery
google.load("jqueryui", "1");
本文介绍了两种通过Google CDN加载jQuery的方法。第一种方法是直接在HTML文件中引用jQuery库;第二种方法是使用google.load()函数加载指定版本的jQuery。此外,还提供了如何设置本地备用jQuery以防止CDN失效的解决方案,以及如何始终使用最新版jQuery的方法。
2881

被折叠的 条评论
为什么被折叠?



