Blossom
02-23-2003, 02:12 AM
Can anyone teach me how to write a javascript that creates an array called month. Assign following values to this object:
“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November, “December”.
Print out all the 12 months from the Web Browser.
Charles
02-23-2003, 06:41 AM
<script type="text/javascript">
<!--
document.write(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
// -->
</script>
Or, if you prefer:
<script type="text/javascript">
<!--
document.write('<ul><li>', ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'].join('</li><li>'), '</li></ul>');
// -->
</script>
For further JavaScript requests, please consult the JavaScript forum.
Blossom
02-23-2003, 08:11 PM
2. Write a javascript that display the following table after entering a number. The number of rows displayed will depend on the number that is entered. The following output is obtained when a number 2 is entered:
You have entered 2
Row number
1
2
3. Write a javascript that creates an object prototype called car.
i) A car must have the following properties.
make, model, year, capacity.
ii) Instantiate four cars with different properties and them print out from a web browser.