|
-
Apr 27th, 2003, 04:25 PM
#1
Thread Starter
Fanatic Member
Download and Parse Source
I usually don't do this, but I've had issues with looking up code for Javascript (it took me 4+ hours to figure out how to get a table cell to change bgcolor when the mouse was over it), so I'm gonna blatantly ask for some simple (I hope) code.
In a nutshell, I would like this script to, on clicking a hyperlink, download the source code from a webpage (the URL is determined by putting the text of the URL in between two other strings), extract the text string that is between two other text strings, and display that text in a textbox or table cell.
So, (I'm making up the objects and functions/using VB-style functions, but they should make sense):
sURL = "const string 1" + hyperlink.text + "const string 2";
sSource = DownloadSource(sURL);
lStart = FindString(sSource, "const left string");
lEnd = FindString(sSource, "const right string");
sDisplay = SubStr(sSource, lStart, lEnd - lStart);
TextBox.text = sDisplay;
Thanks in advance.
-
Apr 28th, 2003, 03:00 AM
#2
You can't download source with JavaScript. You can set the source of a hidden iframe, but then you don't know how long it will take until you have the source available.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 28th, 2003, 05:15 AM
#3
Thread Starter
Fanatic Member
It seems your are saying to open a hidden iframe, and then wait until I can see the </html> tag, then parse it? If so, could you provide some example code (unless it's much more complex than I made it out to be in my pseudo-code example).
-
Apr 29th, 2003, 09:17 AM
#4
You could also do things in the loaded page's body.onload.
You can access the parent document from within the iframe with
window.parent.document
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|