Sunday, January 29, 2012

Html using javascript with arrays

<html>
<head>
<title>Wishes</title>
<script language="JavaScript">
 var a=[25,37,12,3,16,8];
 var i,j;
 document.writeln("<table border='5'>");
 document.writeln("<tr>");
 document.writeln("<th>"+"
Position"+"</th>");
 document.writeln("<th>"+"
Feadf"+"</th>");
 document.writeln("<th>"+"
Length"+"</th>");
 document.writeln("</tr>");
 for(i=0;i<=a.length;i++)
 {
  document.writeln("<tr>");
  document.writeln("<td>" + i + "</td>");
 
  document.writeln("<td>");
  document.writeln(a[i]);
  document.writeln("</td>");
  document.writeln("<td>");
  for(j=1;j<=a[i];j++)
  {
   document.writeln("*");
  }
  document.writeln("</td>");
  document.writeln("</tr>");
}
document.writeln("</tr>");
document.writeln("</table>");
</script>
</head>
<body>
</body>
</html>

No comments:

Post a Comment

Comments

Protected by Copyscape Plagiarism Software