Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>&lt;pre&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Mileage Record&lt;/title&gt; &lt;style type = "text/css"&gt; table { width:300px; border-collapse:collapse; background-color:lightblue; } table, td, th { border: 1px solid black; padding: 4px; } th { text-align: left; color: white; background-color: darkblue } tr.oddrow { background-color: white; } &lt;/style&gt; &lt;script&gt; // var milesDriven; // var gallonsUsed; // var mpg; var anyMore=0; var str="&lt;table&gt;"; str+="&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Miles Driven&lt;/th&gt;"; str+="&lt;th&gt;Gallons Used&lt;/th&gt;"; str+="&lt;th&gt;MPG&lt;/th&gt;"; str+="&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;"; function milesDriven(){ return window.prompt("How many miles did you drive?"); } function gallonsUsed(){ return window.prompt("How many gallons did you use?"); } function mpg(){ return milesDriven()/gallonsUsed(); } function addComponentsToDOM(){ while (anyMore&lt;3) { //not 0 is true or not undefined is true or not null is true str+="&lt;tr&gt;&lt;td&gt;" + milesDriven() + "&lt;/td&gt;&lt;td&gt;" + gallonsUsed() + "&lt;/td&gt;&lt;td&gt;" + mpg() + "&lt;/td&gt;&lt;/tr&gt;" // anymore = confirm("Do you have any more data to input?"); anyMore++; } str+="&lt;/tbody&gt;&lt;/table&gt;"; //document.writeln(); i suggest you not use this method add component to DOM tree //because this method first empty DOM tree content document.body.innerHTML=str; } //why use this event,because window after loaded document.body not null window.onload=addComponentsToDOM; &lt;/script&gt; &lt;/pre&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload