我正在使用phonegap與android。我正在創建一個登錄頁面。登錄驗證後,如果用戶被授權,我想跳轉到歡迎div。如何從javascript調用html頁面div?
這是我的JavaScript頁面: - myjavascrpt.js
var logi=item.id;
if(logi>0)
call welcome div of index.html
else
alert("invalid user");
// in this logi variable i have userid of successful user.
// now i want to
// display this id into the div which is exist in my
// html page.
// now what should i write here so i can call welcome
// div of html page and i can use
// this value of logi variable.
這是我的index.html,其受歡迎的div我要打電話。
<html>
<head></head>
<body>
<div data-role="page" data-theme="a" data-url="streaming" id="streaming">
<h1> do some thing related to streaming</h1>
</div>
**
<div data-role="page" data-theme="a" data-url="welcome" id="welcome">
<h1> you are welcome</h1>
</div>
**
</body>
</html>
所以請告訴我應該用什麼樣的代碼來調用html頁面的div。
先生,請看看我的更新問題。 –
'if(logi> 0){var 0 = document.getElementByID(「userwelcome」); d.innerHTML = logi;}' – eckes
是的,你是對的,但我怎樣才能顯示index.html的歡迎div。 –