我可以捕捉并使用JavaScript保存网页的当前状态状态、网页、JavaScript

由网友(一朵尐籹孓°)分享简介:我需要得到一个网页的全部内容与JavaScript并将其发送到服务器脚本保存它。我想这样做后,在用户中取得使用AJAX和其他JavaScript工具,一些修改页面。我不希望某些元素的状态。我想从根本上得到的一切身体标记内,所以我可以将它传递到服务器端脚本。我已经试过的getElementById等,但似乎把页面在一个循...

我需要得到一个网页的全部内容与JavaScript并将其发送到服务器脚本保存它。我想这样做后,在用户中取得使用AJAX和其他JavaScript工具,一些修改页面。我不希望某些元素的状态。我想从根本上得到的一切身体标记内,所以我可以将它传递到服务器端脚本。我已经试过的getElementById等,但似乎把页面在一个循环和崩溃。

I need to get the entire contents of a page with javascript and send it to a server script to save it. I want to do this after the user has made some changes to the page using AJAX and other javascript tools. I don't want the state of certain elements. I'd like to essentially get everything inside the body tag so I can pass it to a server-side script. I have tried getelementbyid etc. but it seems to put the page in a loop and crashes.

感谢

推荐答案

请尝试以下code:

var body = document.getElementsByTagName("body");
var bodycontent = body[0];

然后使用bodycontent.innerHTML来检索它的内容。如果我没有记错的话,它应该提供人体的当前内容后,已给它的任何JavaScript修改。

Then use "bodycontent.innerHTML" to retrieve the contents of it. If I'm not mistaken, it should provide the body's current content, after any javascript modifications that have been made to it.

阅读全文

相关推荐

最新文章