将tumble-bar.html导入index.html的问题

时间:2016-01-16 19:41:48

标签: javascript jquery html css

我正在尝试使用 tumble-bar.js tumble-bar.html 导入 index.html

我正在使用GitHub,因此我无法使用PHP的导入。

的index.html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <title>Tumblegamer WebSearch</title>
        <link href='https://fonts.googleapis.com/css?family=Oswald:400,300,700subset=latin,latin-ext' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic' rel='stylesheet' type='text/css'>

        <link rel="stylesheet" href="I DONT WANT TO ADVERTISE/stylesheets/style.css">
        <link rel="stylesheet" href="I DONT WANT TO ADVERTISE/stylesheets/tumble-bar.css">

        <script type="text/javascript" src="http://code.jquery.com/jquery-/*I DONT KNOW WHAT VERSION TO USE*/.js"></script> 
        <script src="I DONT WANT TO ADVERTISE/javascript/tumble-bar.js"></script>

        <!-- Put the following javascript before the closing </head> tag. -->
        <script>
          (function() {
            var cx = 'I DONT WANT TO ADVERTISE';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                '//cse.google.com/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
          })();
        </script>
    </head>
    <body>
        <div class="content">
            <center>
                <header>
                    <div class="tumble"></div><!-- I want to put tumble-bar.html here -->
                </header>
                <main>
                    <img class="Logo" src="I DONT WANT TO ADVERTISE">
                    <gcse:searchbox-only></gcse:searchbox-only>
                    <br>
                    <br>
                    <br>
                    <br>
                    <p><strong>New:</strong><a href="I DONT WANT TO ADVERTISE">Alpha Test Tumble NetBrowse</a>.</p>
                </main>
                <footer>
                    © 2015 Tumblegamer - <a href="I DONT WANT TO ADVERTISE">Tumblegamer Home</a> - <a href="I DONT WANT TO ADVERTISE">About Tumblegamer</a> - Tumble NetSearch Alpha (<a href="I DONT WANT TO ADVERTISE">about</a>)
                </footer>
            </center>
        </div>
    </body>
</html>

翻滚-一个bar.html:

<navbar class"TumbleBar">   
    <center>
        <ul>
            <li><a href="I DONT WANT TO ADVERTISE" class="active">Search</a></li>
            <li><a href="I DONT WANT TO ADVERTISE">Blog</a></li>
            <li><a href="I DONT WANT TO ADVERTISE">YouTube</a></li>
            <li><a href="I DONT WANT TO ADVERTISE">Downloads</a></li>
            <li><a href="I DONT WANT TO ADVERTISE">Mail</a></li>
            <li><a href="#">Social &#x25BC;</a>
                <ul class="submenu">
                    <li><a href="I DONT WANT TO ADVERTISE">Facebook</a></li>
                    <li><a href="I DONT WANT TO ADVERTISE">Twitter</a></li>
                    <li><a href="I DONT WANT TO ADVERTISE">Google+</a></li>
                    <li><a href="I DONT WANT TO ADVERTISE">Twitch</a></li>
                </ul>
            </li>
        </ul>
    </center>
</navbar>

您能否帮助我将 tumble-bar.html 导入<div class="tumble"></div>并告诉我您使用的jQuery版本的<script></script>命令?

1 个答案:

答案 0 :(得分:0)

只需$().load()即可获得该HTML。

SELECT M.MODELID,
M.MODELNAME,
C.MONTH,
SUM(C.SALE) as SUM_SALE    

您还可以找到$(document).load(function () {})之类的内容。它的功能不同,因为它会在加载文档时执行$('.tumble').load('tumble-bar.html', function () {/* callback if needed */});

调用之间的区别在于,在第一个调用中,您将字符串作为URL传递。

关于jQuery版本:
function版本将支持较旧的IE浏览器,因此速度较慢 1.*已经抛出了旧的IE支持,并有一些更多的改进。

要重新开始使用2.*版本。如果您有一些旧代码,请使用与该代码相同的jQuery。