alert then submit
Hi,
how can i display the alert message then submit the form? the code below is working fine but if i add the line"{alert("You had selected correct answer D.")}" then it shows error for Object expected. The reason i do this because i want it to display the meesage to let users know that they had selected the correct answer first then submit the form afteward. Can anyone please help ? - thanks
function checkQ() {
chosen = ""
len = document.form26.benchmark.length
for (i = 0; i <len; i++) {
if (document.form26.benchmark.checked) {
chosen = document.form26.benchmark.value
}
}
if (chosen == "D")
{alert("You had selected correct answer D.")}
{
document.getElementById("form26").submit();
}
else {
alert("You chose the wrong value. Please try again.")
}
}
