Changes JavaScript code to support Firefox

Moved innerText changes to a function that also modified the innerHTML
property, since Firefox didn't recognize innerText. Also adds some anonymous
elements to the document, since Firefox did not interact properly with
them.