View Single Post
~ Б0ЯИ Τ0 С0δЭ ~
27Aug2009,19:37  
SaswatPadhi's Avatar
Hi all,

I hope JS experts can help me with this one.

I accept a web-page(HTML) using XMLHttpRequest. Then, I want to parse the HTML, so that I can access the DOM tree of the page.
Can anyone help me with this ?

I have tried doing it like :

Code: JavaScript
var data = XHR.responseText;
var myDiv = document.createElement("div");

myDiv.innerHTML = data.replace(/<script(.|\s)*?\/script>/g, '');

Then I try doing things like :
Code: JavaScript
myDiv.getElementsByTagName("table");
but they fail.

Thanx

Saswat