0
如果我在警告框中單擊「確定」,我想加載圖像。 我做了一個測驗,所以如果你點擊答案「B」,你會得到一個警告框,「這是正確的答案!你現在已經解鎖了一個新的圖像!」之後,在我的div中顯示實際圖像或類似的東西。在警告框後加載圖像
這是我有:
function buttonClick() {
if (document.getElementById("option1").checked == true) {
alert("Wrong, the answer was B");
}
else if (document.getElementById("option2").checked == true) {
alert("This is the right answer!, you have now unlocked a new image!, click OK to see it");
}
else if (document.getElementById("option3").checked == true) {
alert("Wrong, the answer was B");
}
else {
alert("Choose an answer")
}
}
我的HTML
<form action="#" method="get">
<input type="radio" name="groter" value="97" id="option1" >A. 97 keer<br>
<input type="radio" name="groter" value="79" id="option2" >B. 79 keer<br>
<input type="radio" name="groter" value="21" id="option3" >C. 21 keer<br>
<button type="button" onclick="buttonClick()">Controleer</button>
</form>
它的工作原理!謝謝!但是,如果我想編輯圖像的樣式,在CSS中怎麼可能? – K1pc0rn
使用jQuery有可能淡化它嗎?我對此很陌生:S – K1pc0rn