下面,我对4个问题进行了一个小测验,而问题2,3和4已被CSS隐藏,但是您可以尝试从CSS中删除样式(".pytja2, .pytja3, .pytja4 { display: none;}")以查看所有问题,或者display: hidden逐一为每个问题设置样式会看到他们。
我这样做,是因为我想显示下一个问题,当我点击按钮,接下来再下一个问题将展示后,我点击下一步每次按钮。但是问题2没有显示,控制台日志中没有显示任何错误,我在JavaScript上添加了一个函数,当我单击按钮“下一步”时,第一个问题将被隐藏,并显示下一个问题,但我不知道怎么了。
<div class="quiz">
<div id="pytja1">
<span class="quest1">I am a ?</span>
<form class="questions1" action="">
<input class="correct" type="radio" name="gender" value="male"> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other<br>
<input id="bot" type="button" value="Next">
</form>
</div>
<div id="pytja2">
<span class="quest2">Football has letters ?</span>
<form class="questions2" action="">
<input class="correct" type="radio" name="gender" value="male"> 7<br>
<input type="radio" name="gender" value="female"> 5<br>
<input type="radio" name="gender" value="other"> 6<br>
<input id="bot" type="button" value="Next">
</form>
</div>
<div id="pytja3">
<span class="quest3">VV stands for ?</span>
<form class="questions3" action="">
<input type="radio" name="gender" value="male"> BMW <br>
<input class="correct" type="radio" name="gender" value="female"> Volksvagen<br>
<input type="radio" name="gender" value="other"> Audi<br>
<input id="bot" type="button" value="Next">
</form>
</div>
<div id="pytja4">
<span class="quest4">What year it is ?</span>
<form class="questions4" action="">
<input type="radio" name="gender" value="male"> 2017<br>
<input type="radio" name="gender" value="female"> 2015<br>
<input class="correct" type="radio" name="gender" value="other"> 2019<br>
<input id="bot-submit" type="submit" value="Submit">
</form>
</div>
</div>
相关分类