/    Sign up×
Community /Pin to ProfileBookmark

Grabbing data from a 2nd and 3rd page

I want to load two web pages, and using data contained on them create and display a document in the current browser. But I must have a basic misunderstanding of the document object.

This is how I [I]think[/I] it should work:
//load the other page:
var doc1=document.open(“file:///C:/Java/JavaScript/Samples/page1.htm”);
//print data from it:
document.write(doc1.title);

What I get is the title of the current document object, not the title of the document I loaded into doc1. The [B]lastUpdated [/B]property just returns <undefined>.

I also tried using a second window:
//load the other page:
var doc2=window.open(“file:///C:/Java/JavaScript/Samples/page1.htm”);
//print data from it:
document.write(doc2.document.title);

This just breaks. Is it possible to load two other web pages and access the data on them?

?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Sep 20.2008 — Well lastUpdated only works on a server enviornment so there is issue one.

You need to learn when to use window and when to use document.

You should not use write() after a page is loaded.

If you want to read a value from a pop up window, you need to reference it properly and it needs to be fully rendered.

Eric
Copy linkTweet thisAlerts:
@neeeolauthorSep 20.2008 — I gather from your response that I can't really do what I want using JavaScript. Thanks for the help.
×

Success!

Help @neeeol spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...