hi everyone I am new to Javascript and would like to know how would I refresh an if else statement in javascript every 5 seconds, i have looked and cannot get anything to work thanks in advance.
<script type="text/javascript">
if(total == randnum) {
document.write('Correct');
} else {
document.write('Incorrect');
}
</script>
Do you need to write out the document or can you display the text in some element like a
div
?If so then you can try something similar to what 'chopper' suggested:
Assuming you have a
div
in your page with the id "myDiv"Then use this to write out your text: