我已经使用html5和jQuery,jQuery-mobile实现了登录屏幕。
App.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Application</title>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.1.1.css" />
<!-- <link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.1.1.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.1.1.css" /> -->
<link rel="stylesheet" type="text/css" href="css/login.css" />
<script type="text/javascript" src='js/jquery-1.8.2.js'></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<div data-role="page" id="pagecontent" class="type-interior">
</div>
</body>
</html>
登录.js
var _header = "<div data-role='header' data-theme='b' ><h1 id='pheader'>Mobile Sign On </h1> <a data-role='button' id='logoutbtn' data-theme='b' class='hide'>Logout</a></div>";
var _content ="<div data-role='content'>" +
"<div align='center' id='logindiv'>"+
"<div data-role='fieldcontain'><label for='userid' id='luserid'>User Name *:</label>"+
"<input type='text' name='userid' id='userid' value='' class='logon required' placeholder='Username' /></div>"+
"<div data-role='fieldcontain'><label for='password' id='lpassword'>Password *:</label><input type='password' name='password' id='password' class='logon required' value='' placeholder='Password' /></div>"+
"<div data-role='fieldcontain'><fieldset class='ui-grid-a'><a data-role='button' id='loginbtn' data-theme='b'>Login</a></fieldset></div></div></div>";
将标题和内容附加到页面。
$(document).ready(function(){
$('#pagecontent').append(_header).trigger("pagecreate");
$('#pagecontent').append(_content).trigger("pagecreate");
}
我可以在chrome中获取登录屏幕,但不能在移动设备和Mozilla firefox上获取
你可以帮我解决这个问题。
答案 0 :(得分:0)
Srikanth,document.ready()与JQM的实现方式略有不同,也许会这样吗?
$(document).bind('pageinit',function()
{
$.mobile.changePage("#pagecontent", { transition: "slide" });
$('#pagecontent').live('pageshow', function (event, ui) {
$('#pagecontent').append(_header).trigger("pagecreate");
$('#pagecontent').append(_content).trigger("pagecreate");
});
});