嗨,我正在開發phonegap應用程序。如果我在index.html文件中使用console.log,那麼它會打印,但如果我在另一個文件中使用它,它不會打印。如果假設我導入文件index.html文件,如:如何導入.js文件
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jqm.autoComplete-1.4.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
<script type="text/javascript">
console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
</script>
</head>
<body>
<div data-role="page" id="home" data-add-back-btn="true">
<div data-role="content" >
<a href="UI/Equity/test.html" data-role="button" id="myButton">index</a>
</div>
</div>
</body>
</html>
然後頁面顯示有按鈕和打印!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!。但在按鈕的點擊它顯示的test.html文件,該文件是這樣的:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jqm.autoComplete-1.4.js"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
<script type="text/javascript">
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
</script>
</head>
<body>
<div data-role="page" id="home" data-add-back-btn="true">
<div data-role="content" >
<a href="#" data-role="button" id="myButton">Test</a>
</div>
</div>
</body>
</html>
但這裏不打印@@@@@@@@@@@@@@@@@@@@@ @@@@@@@爲什麼這樣?
什麼是文件夾的層次結構index.html和t est.html? – Adil 2012-07-07 06:53:06
索引文件在www文件夾中(索引文件是應用程序的入口點) 測試文件在www/UI/Equity文件夾中 – PPD 2012-07-07 06:57:29