HTML and JavaScript are 2 different technologies - you should not try to convert one to the other. Use JavaScript within HTML to add dynamic abilities to the page like hide/display an HTML element . You can also use JavaScript to create new HTML elements like rows in a table or simply "write" HTML code to the page using document.write("test") function.
If you want to convert existing HTML code into document.write() sentences to make that HTML code, you can use this online free conversion tool . If you're looking for another technique like AJAX, please explain your needs better .