"items.length" of items is really the count of how many items are in "items".
Since you have asked for byTagName("*"), every single tag in the document is counted, to end up with 15 items, including <ul>, 3x<li> etc
>> alert(purchases.length);
purchases is never defined in your javascript.
alert(shooping);
is a better bet since you have defined it as getElementById('purchases')
It is a single element, so it has no ".length" property.