I have this script, it works, this program caputura the information of the months of the year, and shows them, is within a for cycle, the program that I have is the following:
I want you to print the month's message like this:
The first month is: The second month is: The third month is:
..... month is:
That is to say that these words (first, second, third) is a variable or an accumulator, how could you do it for this?
<script type="text/javascript">
function Mostrarmeses(meses) {
var meses = ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
document.write('<br>');
for (var i = 0; i<12; i++)
{
document.write('<br>');
document.write("El mes es "+meses[i]);
document.write('<br>');
}
}
</script>
<html>
<head>
<title>Meses del año</title>
<meta charset="utf-8">
<style type="text/css">
body {
background-color:#FF0000;
}
</style>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<font color="#030303" face="georgia" size="5">
<center>
<TABLE BORDER=3 width="1000" height="50">
<TR><TD>
<font face="georgia" size="30">
<MARQUEE SCROLLAMOUNT=10 BEHAVIOR="alternate"><b>Meses del año</b></MARQUEE>
</font>
</TD></TR>
</TABLE>
<button type='button' onclick='Mostrarmeses()'>Presiona para ver los meses</button><br/>
</center>
</font>
</body>
</html>