I am new to the forum, this should be a simple question though. First off thanks for any help you guys can provide. When I run this code the css doesn’t show up, but the code runs properly. I have cut out everything but the meat. Let me know what I am doing wrong. This is for my JavaScript class so explanations are very valuable to me!
[code]
<style type = “text/css”>
table { width: 10em }
th { text-align: left }
</style>
<script type = “text/javascript”>
<!–
function Arrays()
{
var color = new Array( “cyan”, “magenta”, “red”, “black” );
var even = new Array( “2”, “4”, “6”, “8” );
var integer = [0 , , , 6];
for ( var i = color; i < color.length; i++ )
color[ i ] = i;
for ( i = even; i < even.length; i++ )
even[ i ] = i;
for ( i = integer; i < integer.length; i++ )
integer[ i ] = i;
outputArray( “Array colors contain”, color );
outputArray( “Array integers contain”, even );
outputArray( “Array integers1 contain”, integer );
}
function outputArray( header, whichArray )
{
document.writeln( “<h4>” + header + “</h4>” );
document.writeln( “<table border = “1”” );
document.writeln( “<thead><th>Subscript</th>” +
“<th>Value</th></thead><tbody>” );
for ( var i = 0; i < whichArray.length; i++ )
document.writeln( “<tr><td>” + i + “</td><td>” +
whichArray[ i ] + “</td></tr>” );
document.writeln( “</tbody></table>” );
}
// –>
</script>
</head><body onload = “Arrays()”></body>