0
我對編碼非常陌生,並且正在努力爲研究創建一個應用程序。我無法使用cordova和Xcode在我的應用程序的正確頁面上顯示元素。基本上,我想在我的應用程序結尾處顯示可點擊的電話號碼,並且無法讓該元素僅在該頁面上顯示(而不是在應用程序的每個頁面上)。我已經想出瞭如何隱藏元素,但現在我無法讓它出現在正確的位置。這裏是我的html代碼:使用Cordova顯示和隱藏元素
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
</script>
</head>
<body>
<!-- HTML Template -->
<body onload="app.initialize()">
<div class="app">
<div id="window">
<div id="question">
</div>
<div id="popup" style="display:none">
Please call any of the below:
Phone System: <a href="tel:+1-800-555-5555" class="button button-positive">800-555-5555</a>
</div>
</body>
</html>
我想包括我的.js文件下,但它沒有工作:
var $prehashval = "";
function loop()
{
if (location.hash.slice(1)!=$prehashval)
hashChanged();
$prehashval = location.hash.slice(1);
setTimeout("loop()", 100);
}
function hashChanged()
{
var $output;
switch (location.hash.slice(1))
{
case "question":
document.getElementById('question').style.display = "";
document.getElementById('popup').style.display = "none";
break;
case "popup":
document.getElementById('question').style.display = "none";
document.getElementById('popup').style.display = "";
break;
default:
$output = location.hash.slice(1);
}
}
loop();
我也嘗試添加以下內容:
$("#popup").hide()
$("#popup").display()
沒有運氣。將不勝感激任何意見!謝謝。