控制组中的按钮未按预期重定向 - jQuery mobile
下面的代码似乎没有正确重定向。 该代码位于名为 options.html 的 html 文件中,当我单击“测验”时,导航到的 URL 为 /options.html#results.jsp。重定向 URL 不应该是 /results.jsp 吗?
<!DOCTYPE html>
<html>
<head>
<title>Options</title>
<link rel="stylesheet" type="text/css" href="jquery.mobile-1.0a4.1.css" />
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0a4.1.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0a4.1.js"></script>
</head>
<body>
<!-- Page starts here -->
<div data-role="page" data-theme="b" id="page1">
<div data-role="header" id="hdrMain" name="hdrMain" data-nobackbtn="true">
<h1>Options</h1>
</div>
<center>
<div data-role="content" id="contentMain" name="contentMain">
<form id="form1">
<div data-role="controlgroup">
<a href="results.jsp" data-role="button" >Quiz</a>
<a href="index.html" data-role="button" >No</a>
<a href="index.html" data-role="button" >Maybe</a>
</div>
</div><!-- contentMain -->
</center>
</div> <!-- page1 -->
<!-- Page ends here -->
</body>
</html>
Below code does not seem to be redirecting properly.
The code is in a html file named options.html and when I click "Quiz" the URL that is navigated to is /options.html#results.jsp. Should the redirect URL not be /results.jsp instead ?
<!DOCTYPE html>
<html>
<head>
<title>Options</title>
<link rel="stylesheet" type="text/css" href="jquery.mobile-1.0a4.1.css" />
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0a4.1.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0a4.1.js"></script>
</head>
<body>
<!-- Page starts here -->
<div data-role="page" data-theme="b" id="page1">
<div data-role="header" id="hdrMain" name="hdrMain" data-nobackbtn="true">
<h1>Options</h1>
</div>
<center>
<div data-role="content" id="contentMain" name="contentMain">
<form id="form1">
<div data-role="controlgroup">
<a href="results.jsp" data-role="button" >Quiz</a>
<a href="index.html" data-role="button" >No</a>
<a href="index.html" data-role="button" >Maybe</a>
</div>
</div><!-- contentMain -->
</center>
</div> <!-- page1 -->
<!-- Page ends here -->
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不想使用 AJAX 导航,请在 a-tag
请参阅 http://jquerymobile.com/demos/1.0a4.1/#docs/pages/docs-navmodel.html
如果您需要更深入地了解 jQuery Mobile 中的导航,查看这个有用的指南
http://jqx.ca/nav/
If you don't want to use AJAX navigation, use any of the following attributes on the a-tag
See http://jquerymobile.com/demos/1.0a4.1/#docs/pages/docs-navmodel.html
In case you need a more in-depth look at navigation in jQuery Mobile, check out this helpful guide
http://jqx.ca/nav/
这就是 jQuery Mobile 的工作原理。如果浏览器支持 AJAX,那么所有请求都将通过 ajax 获取并由 jQuery Mobile 管理。
请阅读文档的前几章。
That is how jQuery Mobile works. If the browser is capable of AJAX then all requests are fetched with ajax and managed by jQuery Mobile.
Please read the first few chapters of the documentation.