zoukankan      html  css  js  c++  java
  • Google Ajax Library API使用方法(JQuery)

    Google Ajax Library API使用方法

    1.传统方式:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

    2.使用google.load载入:

    <script src="http://www.google.com/jsapi?key=INSERT-YOUR-KEY" type="text/javascript"></script>
    <script type="text/javascript">
    google.load("jquery","1");//Load jQuery(1代表1.9+的最新版本,也可具体指定1.8.2)
    (function(){
    //根据传入的url,在head里生成script引用DOM对象
    function createScriptLink(url){
    var scriptElement = document.createElement('script');
        scriptElement.setAttribute('type', 'text/javascript');
            scriptElement.setAttribute('src', url);
    document.head.appendChild(scriptElement);
    }
    window.jQuery || createScriptLink('//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js')
    if (typeof jQuery == 'undefined') createScriptLink('//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
    })();
    </script>
    <script src="http://www.google.com/jsapi?key=INSERT-YOUR-KEY"></script>
    <script>
        google.load("jquery", "1");//Load jQuery
        google.load("swfobject", "2.2");
        google.load('maps', '2', {'callback': googleMapSetup });
        google.setOnLoadCallback(function() {
            $(function() {
              // Place init code here instead of $(document).ready()
            });
        });

    //页面输出script引用 if (typeof jQuery == 'undefined')
    document.write(unescape("%3Cscript src='js/jquery.1.7.1.min.js' type='text/javascript'%3E%3C/script%3E")); window.jQuery || document.write('<script src="js/jquery.1.7.1.min.js" type="text/javascript"></script>') </script>
  • 相关阅读:
    HDU 6071
    HDU 6073
    HDU 2124 Repair the Wall(贪心)
    HDU 2037 今年暑假不AC(贪心)
    HDU 1257 最少拦截系统(贪心)
    HDU 1789 Doing Homework again(贪心)
    HDU 1009 FatMouse' Trade(贪心)
    HDU 2216 Game III(BFS)
    HDU 1509 Windows Message Queue(队列)
    HDU 1081 To The Max(动态规划)
  • 原文地址:https://www.cnblogs.com/blog-leo/p/3659264.html
Copyright © 2011-2022 走看看