lundi 27 juillet 2015

How can I have refresh page link/button inside my JavaScript code?

Basically I have the following code which checks the user input and gives the output accordingly:

    function checkUserInput() {
    var userInput = document.getElementById("textInput").value;
    var stringToCheckAgainst = random_images_array[num].split('.');
    if (userInput.toUpperCase() == stringToCheckAgainst[0].toUpperCase()) {

document.getElementById("row1").innerHTML="<p>" + txt.fontsize(5) + "</p>";document.close();
} else {

//user has inputted an incorrect string
document.getElementById("row1").innerHTML="<p>" + txt1.fontsize(5) + "</p>";document.close();
}
}
</script>

However my problem is, in the case that the user response is not correct and the programme only displays the “incorrect message”, I need to show a refresh or reset button or text that by clicking on that link the user can again refresh the page and gets a new challenge.




Aucun commentaire:

Enregistrer un commentaire