lYriCAlsSH
lYriCAlsSH

Reputation: 58037

Array.length problem in JavaScript

I've written this sample code to print the length of x. But for some reason, I am not getting anything! Help!

<html>
<head>
<script type = "text/javascript">
function myF()
{
   var x = [1,2,3,4];
   var y = document.getElementById("thing");
   y.innerHtml = x.length;
}
</script>
</head>

<body onload = "myF();" >

<div id = "thing" >
PRINT TEST
</div>

</body>
</html>

Upvotes: 0

Views: 1129

Answers (1)

Andy Hume
Andy Hume

Reputation: 41664

The property name is innerHTML rather than innerHtml.

Upvotes: 7

Related Questions