Convert HTML to Javascript DOM [ Online Tool ]

There are lot of scenarios where a programmer is required to convert HTML code rendered using Javascript instead of using it directly over the page. HTML2JS is one such online tool which convert well formed HTML code into javascript DOM code and coder can direcly embed in their applications.

Convert HTML to Javascript code
Convert HTML to Javascript code

Just add your well formed HTML into the left text area and convert it into Javascript. Here is a sample of a converted HTML to Javascript. Try HTML2JS now

function createHTML(root){
var oTable=root.appendChild(document.createElement("table"));
with(oTable){

id="waiterBlock";
style.display="none";
}

var oText = oTable.appendChild (document.createTextNode("
"));
var oTr=oTable.appendChild(document.createElement("tr"));
var oText = oTr.appendChild (document.createTextNode("
"));
var oTd=oTr.appendChild(document.createElement("td"));
var oText = oTd.appendChild (document.createTextNode("some text here ..."));
var oTd=oTr.appendChild(document.createElement("td"));
with(oTd){

className="myClass";
}

var oText = oTd.appendChild (document.createTextNode("
"));
var oDiv=oTd.appendChild(document.createElement("div"));
with(oDiv){

id="oWaiter";
style.display="none";
style.position="relative";
style.border="1px gray solid";
style.overflow="hidden";
style.width="200px";
style.height="15px";
style.backgroundColor="#FFF";
}

var oText = oDiv.appendChild (document.createTextNode("
"));
var oDiv=oDiv.appendChild(document.createElement("div"));
with(oDiv){

id="oWaiterInner";
style.width="40px";
style.height="15px";
style.overflow="hidden";
style.background="#3366cc";
style.position="absolute";
style.top="0px";
style.left="0px";
}

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here