Home » Programming

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";
}

Tagged with: | Need more help ? Ask your Questions at our Support Center | Follow us on Twitter @TSNW or Facebook
Facebook Share Print This Post

Posted on 1st December 2008 by Ashish Mohta , A Professional Tech blogger, Editor and Writer who talks about solving day to day problems of people who use computer. He also writes on How to use the applications like Office, PC tips, Online tools,Browsers and more. All posts by Ashish Mohta | Connect with me @ Twitter | Linkedin | Facebook | Stumble

One Comment »

  • ilyas said:

    thanx dude this is very good converting tool ..

Leave your response!

Be nice. Keep it clean. Stay on topic. No spam.