In the example above, the h1 element becomes a node in the document.. The write() method is mostly used for testing: If it is used after an HTML document is fully loaded, it will delete all existing HTML. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. We have added comments next to each line of code, so that you can understand it. This is the simplest form of accessing data from HTML document. document is fully loaded, it will delete all existing HTML. However, if your script needs to run at a certain p… A basic HTML file has a docType and some basic HTML tags, such as , and . Very useful in applications where the code must be dynamically generated, such as contents inside a JavaScript scroller, text of a random quote script etc. There are several methods to do it. It is basically a JavaScript program (fs.js) where function for writing operations is written. Embedding code; Inline code; External file; We will see three of them step by step. Want to read data from HTML document? An HTML table is represented in the DOM by the HTMLTableElement. I'm making a mini-game where a player attacks a npc and in the center is a white box (div) that I call (log), because when the player damages/attacks the npc, I want to … The