A Pen by Smith

Thumbnail
This awesome code was written by ssmitty, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright ssmitty ©
  • HTML
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Smith </title>
  
  
  
  
  
</head>

<body>

  <DOCTYPE html>
<html>
<head>
     <title>Smith S Lab 3</title>
	<link rel="stylesheet" href="Task2.css" type="text/css" />
  <script lanuage="Javascript" type="text/javascript">
    <!--
      functiongetLuckyInfo (){
      // Create an array and populate it with 7 colors
      colors= new Array(7);
      colors[0] ="lightpink";
      colors[1] ="orange";
      colors[2] ="yellow";
      colors[3] ="lightgreen";
      colors[4] ="lightblue";
      colors[5] ="violet";
      colors[6] ="white";
      
      /*Calculate a random number between 0 and the number of elelments
        in the colors array*/  
    }
    -->
 document.write("<p style='background-color:" + colors[i] + "'> Your lucky color is " + colors[i] + "</p> )
    
    <!--
 
    

   //-->
  </script>
  
</head>
<body>
  
  <p>
  a.	What variable is defined in the function? <br/>
   Answer:getLuckyInfo<br/>
  b.	How many elements are in the colors array?"<br/>
    Answer:7
  </p>         
 
  <div id="luckyinfo">
             <script language-"Javascript" type="text/javascript">
             <!--
                    getLuckyInfo();
              
        
              -->                
             </sript>  
            </div>
</body>
</html>
  
  

</body>

</html>

Comments