How to dynamically get the DOM of a web page in Javascript
I would want to dynamically get the DOM structure (HTML source) of a web page. I want to do some manipulations with it later. Is this possible in javas开发者_如何学Pythoncript at all?
Thanks.
Your best (and safest) bet is to either fetch the other web page server side and include it in the HTML of your page as a hidden element.
This is possible - it's what javascript is for! Use the document object. i.e.
document.documentElement.innerHTML
Yes, it is. It is a core part of browser's Javascript, DOM manipulation of your web page.
http://www.quirksmode.org/dom/intro.html
https://developer.mozilla.org/en/The_DOM_and_JavaScript
精彩评论