Explore BrainMass

Dialog and Loop in JavaScript

I have this file and I'm trying to Modify the display_alert() function to also display a line of the countdown on the web page.
i don't know how to add the function that calls the document.write() function so that it can pass the parameter variable as an argument to the document.write() function. I need it to write something after each alert. Can someone e please help? See below:

function display_alert (message){
window.alert(message); //
for (var count=1; count<14; count++) {

display_alert("Click ok to continue with the countdown.");
document.write("Ten<br/> Nine<br/> Eight<br/> Seven<br/> Six<br/> Five<br/> Four<br/> Three<br/> Two<br/> One<br/> Ignition Start<br/> Liftoff<br/> We have lift off!<br/> ");

Solution Preview

Hello Student,

If I understand you correctly, this should be the direction you want to go (also attached as a ...

Solution Summary

Working example of a simple Web page (HTML) that iterates through JavaScript displayed messages stepped through by user interaction with a dialog. Attached as .html.