/    Sign up×
Community /Pin to ProfileBookmark

I have a webpage with two frames. I’m trying to write a script that will “read” one particular line of the source for the webpage in frame 2, and then depending on what that line is, bring up some text in frame 1. I just want to know if this is possible to do.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyMar 03.2006 — Yes it is possible, it can be easy or complicated. Heres my easy example.

<page1>
<i>
</i>&lt;html&gt;
&lt;body&gt;
&lt;p id="getMe"&gt;Please take me&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

<page 2>
&lt;html&gt;
&lt;body&gt;
&lt;input type="button" value="Check to see if I can take it" onclick="if(window.[b]pageOneWindowName[/b].document.getElementById('getMe').innerHTML == 'Please take me')this.value='Yes I can take it';return false;"&gt;

You will need to replace the bold part with the window (or frame name) of the first page.
Copy linkTweet thisAlerts:
@wintermuteauthorMar 03.2006 — Thanks for such a quick response. I don't think I was specific enough though. I don't have any control over the webpage that shows in the second frame, so I can't put an id tag in. I'll try and explain exactly what I need to do.

There's a page in a site that shows what map a server is currently on. There's an image that is associated with each map, and when the server is on that map, the page shows the appropriate image. The line of code for the image is what I want to check each time. That will let the other page I'm writing know what map the server is playing. So basically, I need to tell my page to go and look at line 15 of a webpages' source, and then check that line against some condtional statements.

I'm just so stuck on this one bit! I've got the rest of it done, but no way to check that one line.
×

Success!

Help @wintermute 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,
)...