Tim Streater
4/13/2015 1:26:00 PM
In article <mggd3o$n6r$1@dont-email.me>, Robbie Brown <rob@example.com>
wrote:
>On 13/04/15 13:17, Tim Streater wrote:
>> In article <mgg70i$19a$1@dont-email.me>, Robbie Brown <rob@example.com>
>> wrote:
>>
>>> function updateCart(cartXML) {
>>> var cartsnapshot = document.getElementById("cartsnapshot");
>>> cartsnapshot.innerHTML = getCartSnapshot(cartXML);
>>> }
>>
>> Where is the element cartsnapshot defined? Show us its html. ISTM that
>> there is no such element, in which case
>> document.getElementById("cartsnapshot") will return null. Or you are
>> running this javascript before the element is loaded.
>>
>
>Jeez, It's like herding cats sometimes.
Look, d'ye want help or not?
>I have mentioned repeatedly that this code only causes problems in
>Chrome, it works fine in other browsers
To me, that indicates that you're doing something in a non-guaranteed
way that just happens to work in those other browsers, but in Chrome
won't because Chrome happens to do things in a different order.
>there is a common header that is included with every page
>
>in the <head> of the common header I have this
>
><script type="text/javascript">
> window.onload=getCart();
></script>
Personally I tend to do:
<body onload="getCart();">
which works for me, doubtless others may have other preferences.
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee