基本想法是有幾個問題,但只有1個問題在頁面加載時隨機顯示。然後,無論回答那個問題,都會顯示一個下載。顯示下載鏈接的隨機問題
問題隨機加載,但是當我放入答案時,下載不會顯示。我以爲我的代碼都是正確的,但也許有更好的方法來做到這一點。如果你能幫助我,我將不勝感激。
P.S.我已經知道這不是一種超安全的隱藏方式,但它並不需要非常安全。
<form id="1">
Enter the 5th word on page 28 to access the download:
<input id="pwd1" name="pwd1" type="text" />
</form>
<form id="2">
Enter the 6th word on page 29 to access the download:
<input id="pwd2" name="pwd2" type="text" />
</form>
<form id="3">
Enter the 4th word on page 30 to access the download:
<input id="pwd3" name="pwd3" type="text" />
</form>
<form id="4">
Enter the 3rd word on page 32 to access the download:
<input id="pwd4" name="pwd4" type="text" />
</form>
<form id="5">
Enter the 5th word on page 33 to access the download:
<input id="pwd5" name="pwd5" type="text" />
</form>
<form id="6">
Enter the 3rd word on page 34 to access the download:
<input id="pwd6" name="pwd6" type="text" />
</form>
<form id="7">
Enter the 5th word on page 35 to access the download:
<input id="pwd7" name="pwd7" type="text" />
</form>
<form id="8">
Enter the 4th word on page 36 to access the download:
<input id="pwd8" name="pwd8" type="text" />
</form>
<form id="9">
Enter the 6th word on page 37 to access the download:
<input id="pwd9" name="pwd9" type="text" />
</form>
<div id="hc" style="display: none;">
<center><a href="sudoku.zip"><img id="download" src="download.png"></a></center>
</div>
<script language="javascript">
var rand = Math.floor(Math.random()*9);
$('form').hide().eq(rand).show();
$('form').keyup(function(){
if($('#pwd1').val() == 'more'){
$('#hc').show('slow');
}
if($('#pwd2').val() == 'Rectangle'){
$('#hc').show('slow');
}
if($('#pwd3').val() == 'case'){
$('#hc').show('slow');
}
if($('#pwd4').val() == 'similarities'){
$('#hc').show('slow');
}
if($('#pwd5').val() == 'similar'){
$('#hc').show('slow');
}
if($('#pwd6').val() == 'this'){
$('#hc').show('slow');
}
if($('#pwd7').val() == 'done'){
$('#hc').show('slow');
}
if($('#pwd8').val() == 'outside'){
$('#hc').show('slow');
}
if($('#pwd9').val() == 'completed'){
$('#hc').show('slow');
}
else{$('#hc').hide();}
});
</script>
你的代碼適合我。必須添加對jquery的引用。 –