How to get a different site's entire page in a string?
I want to get a different page's entire site in a string so that I can search to see if a certain string is present.
But i don't want www.example.com, I want www.example.com/page1. Then I want to use the results of the search on www.example.com.
Thanks! and sorry for not looking at that first.
However, I have come to the same conclusion as Okham did in that post. I don't quite get it. I tried to implement it but its not working.
Here is what I have:
Please take a look at my code. There are comments where I having trouble.
<b><h1><center>Welcome to my Page!</b></h1></center>
<p><a href="Check1.html">Page 1</a></p>
<p><a href="Check2.html">Page 2</a></p>
<p>The first site is: </p>
var sURL = Check1+".html";
if (oRequest.status==200) var str = oRequest.responseText;
else alert("Error executing XMLHttpRequest call!");
var result = str.search(/down/i);
// I want to queury Check1.html to see if "down" is present, and then
// display an image accordingly. What I have here does not work.
if(result == -1)
// if "down" is not found, then the site is up.
document.write('<img src="Up.png" width ="100" height ="100" alt="Error"/>');
// if "down" is found, then the site is down.
document.write('<img src="Down.png" width ="100" height ="100" alt="Error"/>');
<p>The second site is: </p>
// if the word "up" is found on "Check_Down.html" then display "up.jpg"
// else if the word "down" is found on "Check_Down.html" then display "down.jpg"
Don't get me wrong, I want to learn how it works, but more specific help would be greatly apprciated.
var sURL = Check1+".html"; // This isn't the URL to your file - this is a relative URL path to a variable that doesn't exist (it's undefined) + ".html"
sURL = "http://yourdomain.com/Check1.html"; // or something like that..
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)