• jquery mobile跳转到指定id时怎样传递参数


    在jquery mobile 中,每一个页面都是一个page,当我们需要从一个页面跳转到另一个页面时,可以在href中指定id,可是该怎么把一个page中的参数传递到另外一个page中,几经琢磨,发现可以通过点击函数的参数来传递值,代码如下:

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <link href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css">
    <script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js" type="text/javascript"></script>
    </head>
    
    <body>
    <script>
    function goto_other_page(username){
        $("#page2_username").text(username);
        };
    </script>
    <div data-role="page" id="page1">
      <div data-role="header">
        <h1>标题</h1>
      </div>
      <div data-role="content">
        <ul data-role="listview">
        <!--函数中的参数可以根据需要,通过拼接的方式动态添加-->
          <li><a href="#page2" onClick="goto_other_page('张三');">页面</a></li>
        </ul>
    
    
    
      </div>
      <div data-role="footer" data-position="fixed">
        <h4>脚注</h4>
      </div>
    </div>
    <div data-role="page" id="page2">
      <div data-role="header">
        <h1>标题</h1>
      </div>
      <div data-role="content">
        <label id="page2_username"></label>
      </div>
      <div data-role="footer" data-position="fixed">
        <h4>脚注</h4>
      </div>
    </div>
    
    </body>
    </html>
    
  • 相关阅读:
    【转】如何保护自己的QQ号
    13. 查看数据库对象间的依赖关系
    12. 查询数据库账号的所有权限
    11. 查询数据库各种历史记录
    如何找回SQL Server实例安装时的序列号
    SQL Server Mobile/Compact Edition 简单介绍
    6. SQL Server数据库监控
    5. SQL Server数据库性能监控
    4. SQL Server数据库状态监控
    3. SQL Server数据库状态监控
  • 原文地址:https://www.cnblogs.com/lenve/p/4445109.html
Copyright © 2020-2023  润新知