The JS-Interpreter is a sandbox, it doesn't have any access to the DOM -- unless you provide your own interface functions. This demo creates the following interfaces:
document.getElementById(id)
document.createElement(tagName)
document.createTextNode(text)
Node.prototype.hasChildNodes()
Node.prototype.removeChild(node)
Node.prototype.firstChild/lastChild/parentNode
Element.prototype.appendChild(node)
Element.prototype.innerHTML
This minimal demo can be used as the basis for a more extensive interface. Expose as much of the DOM as you need, but be mindful of providing too much access. For example, granting the ability to set innerHTML enables interpreted code to write script tags. Open your browser's console for errors.
Back to the JS-Interpreter documentation.