<div class="center"data-role="content" id="content" >
<a href="#flappy" data-transition="slide" >Don't Be A Terrorist</a>
</div>
<div id="flappy" >
<center>
<div id="page">
<div data-role="header">
<h1 style="color: white; font-size: 20px;">Don't Be A Terrorist</h1>
<a data-icon="home" data-rel="back" style="margin-top:2px; background-color: white;">....</a>
</div>
<div id="frame" onload="check2()">
<script>
function check2(){
$.get(/flappy.html)
.done(function() {
alert("you have it");
<p style="color: white; margin-top: 30px;">Dont't be a terrorist is a game where you must manoeuvre a plane through buildings. Be careful not to hit one or be labelled a terrorist. <br> Controls:<br>Hold the screen down, to go up <br> Let go, to go down <br> Don't hit buildings or die</p>
<a href="flappy.html" data-transition="pop" rel="external"><img src="images/play.png" width="320px" height="320px"></img></a>
}).fail(function() {
alert("Download it now!");
})
}
</script>
enter code here
</div>
</div>
</center>
</div>
這是我的遊戲網站的代碼,如果文件存在,它應該是一個選項來玩遊戲,但如果它沒有一個按鈕,他們可以選擇下載它。這是我收集的代碼!如果可能的話,我寧願不使用ajax!非常感謝!可下載的內容在Javascript中
謝謝! :)
你的問題是什麼?你在問如何製作下載按鈕? –
該腳本沒有檢查文件是否存在,其次是如何添加下載按鈕:)謝謝@ user2403741 – user3724321
不應將/flappy.html設置爲「/flappy.html」? – jeff