开发者

How to dynamically get the DOM of a web page in Javascript

开发者 https://www.devze.com 2023-01-01 18:24 出处:网络
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?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消