I've stumbled upon this site and was wondering if you all would be willing to help me out.
I'll attach the code in question below, hopefully you all will be able to help :)
Section in the webpage where the function is called.
<form name ="Cone" onload="ConeCalculator(this.form)" id="page_content" style="width: 320px">
document.writeln("<table border =\"0\">");
for (var i = 0; i <= 1; i++)
Minutes = Math.floor( 1 + math.random() * 10);
Seconds = Math.floor( 1 + Math.random() * 60);
document.writeln("<td>" + "Your car finished in " + Minutes + "." + Seconds + "." + "</td></tr>");
Cones = Math.floor( 1 + math.random() * 20);
document.writeln("<td><tr>" + "Cones knocked over" + Cones + "</td></tr>");
Your function contains document.writeln which can only run before the page finishes loading but the function is only called after the page finishes loading.
That's not correct. I've used document.write and document.writeln after a page finishes loading and the output is written to a new page as it is supposed to.
Originally Posted by felgall