I want to execute initialize()
function on page load, but by simple <body onLoad="initialize()">
didn't wo开发者_StackOverflow社区rk when page is called from other page by using $.mobile.changePage
.
I've tried this, but it works fine only when i type the url of the page directly in the browser, not with redirecting.
FireBug: initialize is not defined
<body>
<div data-role="page" id="page" data-theme="c" class="sss">
<div data-role="header">
<h1>Skopje info guide</h1>
</div>
<div data-role="content">
<div id="map_canvas" style="width:100%; height:400px;"></div>
</div>
<div data-role="footer">
<h1>test</h1>
</div><!-- /footer -->
<script type="text/javascript">
$('.sss').live('pageshow', function (event, ui) {
popTable();
initialize();
});
</script>
</div>
</body>
The function initialize()
is in <head>
part, and popTable()
is in another .js file
Sounds like function initialize() is not in the calling page. You either want the calling page to have the function definition, or include the function definition inside the data-role=page div
精彩评论