基本想法是有几个问题,但只有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的引用。 –