Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery链接到其他页面_Javascript_Jquery_Html_Jquery Mobile - Fatal编程技术网

Javascript jQuery链接到其他页面

Javascript jQuery链接到其他页面,javascript,jquery,html,jquery-mobile,Javascript,Jquery,Html,Jquery Mobile,使用jquerymobile,我创建了一个简单的表单,显示一个可折叠的汽车品牌列表。在这个可折叠的列表下将是该汽车品牌的不同型号。当点击/触摸车型时,我希望能够加载到另一个页面,该页面将显示特定车型的一些统计信息。我不太确定如何链接到另一个页面/HTML文件。这就是我到目前为止所做的: <!doctype html> <html> <head> <meta charset="utf-8" /> <sty

使用jquerymobile,我创建了一个简单的表单,显示一个可折叠的汽车品牌列表。在这个可折叠的列表下将是该汽车品牌的不同型号。当点击/触摸车型时,我希望能够加载到另一个页面,该页面将显示特定车型的一些统计信息。我不太确定如何链接到另一个页面/HTML文件。这就是我到目前为止所做的:

    <!doctype html>
    <html>
    <head>
        <meta charset="utf-8" />
<style>
a.test {
font-weight: bold;
        }
        </style>
        <title>My Page</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">    <!-- view port sets the bar as wide as the screen -->
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile- 1.3.2.min.css" />
        <script src="jquery.js"></script>
        <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js">        </script>
    </head>
       <body>
        <div data-role="page">

    <div data-role="header">
        <h1>Dream Ride</h1>
    </div><!-- /header -->

    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h1>Honda</h1>
          //code to link to other HTML files or pages
    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h3>BMW</h3>
        <p>sdfsdf</p>
    </div>
    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h3>Mercedez</h3>
        <p>sdfsdf</p>
    </div>
    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h3>Audi</h3>
        <p>sdfsdf</p>
    </div>
    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h3>Ferrari</h3>
        <p>sdfsdf</p>
    </div>
    <div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
        <h3>Lamborghini</h3>
        <p>sdfsdf</p>
    </div>

    </div><!-- /content -->

    <div data-role="footer">
        <h4>My Footer</h4>
    </div><!-- /footer -->

</div><!-- /page -->


</body>
</html>

a、 试验{
字体大小:粗体;
}
我的页面
梦幻之旅
本田
//链接到其他HTML文件或页面的代码
宝马
sdfsdf

梅塞德斯 sdfsdf

奥迪 sdfsdf

法拉利 sdfsdf

兰博基尼 sdfsdf

我的页脚
我假设您所说的是在不重新加载整个文档的情况下加载页面。要使用jQuery Mobile实现这一点,请创建另一个
,并为其指定一个id属性。在您的第一页中,只需使用锚定标记链接到它:

例如:

<div data-role="page" id="one">
    <div data-role="content">
        <h1>Page One</h1>
        <a href="#two">Go to page two</a>
    </div>
</div>
<div data-role="page" id="two">
    <div data-role="content">
        <h1>Page Two</h1>
        <a href="#one">Go to page one</a>
    </div>
</div>

第一页
第二页

在JSFiddle上演示:

先生,您是对的!我在用是的,你可以。只需将
data role=“button”
添加到
a
标记中即可<代码>