That's because the getElementsByIds fail to find the item and it throws an error thus stopping the script
Either throw a try/catch around it: http://www.w3schools.com/js/js_errors.asp
or check to see if it was found before trying to change it. (Make a var with the element, check to see if it is null, if it is not change the innerHTML)