Extra Credit - var length = prompt("Please...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
<html> <head> <title> Extra Credit </title> </head> <body> <h1> Color Script </h1> <script type="text/javascript"> // Prompt for color and store as a variable var inputcolor = prompt("Please enter a color: ", ""); // Write the color in the color. document.write('<font color="'+inputcolor+'">Hello World</font>'); </script> <br><br><br><hr> <h1> Area Script </h1> <script type="text/javascript"> // Prompt user for length and width and store as variables
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: var length = prompt(&quot;Please enter a length&quot;, &quot;&quot;); var width = prompt(&quot;Please enter a width&quot;, &quot;&quot;); // Calculate the Area and Perimeter and store as variables var area = (length * width); var perimeter = ((length * 2) + (width * 2)); // Display results document.write(&quot;The area of your rectangle is: &quot; + area + &quot;.&lt;br&gt;&quot;); document.write(&quot;The perimeter of your rectangle is: &quot; + perimeter + &quot;.&quot;); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;...
View Full Document

This note was uploaded on 02/08/2011 for the course ECONOMICS 101 taught by Professor June during the Spring '08 term at Rutgers.

Ask a homework question - tutors are online