In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "JS obtaining web page source code". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
JS gets the source code of the web page
Remote web page source code read / * page font style * / body, td, input, textarea {font-family:Arial; font-size:12px;} / / used to create XMLHttpRequest object function createXmlHttp () {/ / use different creation methods if (window.XMLHttpRequest) {xmlHttp = new XMLHttpRequest () depending on whether the window.XMLHttpRequest object exists / / creation methods supported by browsers such as FireFox and Opera} else {xmlHttp = new ActiveXObject ("Microsoft.XMLHTTP"); / / creation methods supported by IE browsers}} / / obtain remote web page source code function getSource () {var url = document.getElementById ("url") directly through XMLHttpRequest object. Value / / get destination address information / / prompt the user to enter if (url = "") {alert ("Please enter a web address if the address is empty.") ; return;} document.getElementById ("source"). Value = "loading." / / prompt that createXmlHttp () is being loaded; / / create XMLHttpRequest object xmlHttp.onreadystatechange = writeSource; / / set callback function xmlHttp.open ("GET", url, true); xmlHttp.send (null) } / / write the remote web page source code to the page text area function writeSource () {if (xmlHttp.readyState = = 4) {document.getElementById ("source"). Value = xmlHttp.responseText;}} remote web page source code read address:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.