如何使用JavaScript将所有带有网站标签的文本复制并存储在一个变量中 [英] How to copy all the text with tags of website and store in one variable using JavaScript

查看:82
本文介绍了如何使用JavaScript将所有带有网站标签的文本复制并存储在一个变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  function  url1()
{
window . location .assign( http:/ /www.example.com
}





首先我要导航这个调用url1()方法的网站,页面加载完成后,带标签的整页文本存储在一个变量中.... plz告诉我解决方案...



提前谢谢.....

解决方案

您可以尝试以下



var strHTML = document .documentElement.innerHTML;


我不知道你的具体情况,但显示你可以使用的变量的值alert

alert(strHTML);

function url1()
{
    window.location.assign("http://www.example.com")
}



First i want to navigate this website for calling url1() method, after page load completed whole page text with tags are store in one variable....plz tell me the solution...

Thank's in advance.....

解决方案

You can try the following

var strHTML=document.documentElement.innerHTML;


I don't know your specific scenario,but to display the value of the variable you can use alert
alert(strHTML);


这篇关于如何使用JavaScript将所有带有网站标签的文本复制并存储在一个变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆