/    Sign up×
Community /Pin to ProfileBookmark

changing target from a frame in a frameset to an inline frame

Hi Everyone:

I have very limited Javascript knowledge. We are trying to switch a page from a frameset (x2 frames) to a regular .html page with an inline frame. The javascript is in the main content area. It writes links to the side column frameset. My boss wants to do away with the frames and have the javascript write to the inline frame. Here is the code that I think applies (in yellow):

[CODE]// Simple error check to make sure that there are markers in the file.
if (iNumMarkers != -1) {
// “For” loop which creates all of the inline JavaScript anchor tags
for (var i = 1; i <= iNumMarkers; i++) {
sTempString = sTempString + “<A HREF=”javascript:parent.frames[1].seekToMarker(“;
sTempString = sTempString + i + “)”>”;
sTempString = sTempString + document.MediaPlayer1.GetMarkerName(i);
sTempString = sTempString + “</A><BR>”
}
// Actual code which writes the information to the other frame.
parent.frames[0].document.open();
parent.frames[0].document.writeln(“<HTML><BODY BGCOLOR=”#ffffff”>”);
parent.frames[0].document.writeln(sTempString);
parent.frames[0].document.writeln(“</BODY></HTML>”);
parent.frames[0].document.close();

} else {

alert(“There are no Markers in this file”);
}
}[/CODE]

I don’t know how to change the “parent.frames[0].document.writeIn to write in the inline frame. The inline frame’s actual page name is: menu.html and the id of the inline frame is: menumarker. The inline frame is located in a page called: player.html

Thanks for any help… I need it!
Bill

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Angry_Black_ManAug 01.2007 — in order to access the iframe, you need to give it an NAME attribute. then, access it using DOM as noted below:

&lt;script&gt;
function update()
{
i_frame.document.writeln("updated.")
}
&lt;/script&gt;

blah

&lt;iframe name="i_frame" width="100" height=100 border=1&gt;&lt;/iframe&gt;

&lt;div onclick="update()"&gt;click to add text to iframe&lt;/div&gt;
Copy linkTweet thisAlerts:
@mechman2authorAug 01.2007 — Hi Aaron:

Thanks for trying to help me. Here is a little more information. The Javascript (currently) is pulling the data from a separate file. It then processes the data and automatically outputs the links to the separate frame in the frameset.

Does "[CODE]<div onclick="update()">click to add text to iframe</div>[/CODE] mean that the user has to click something? I need it to load automatically (The links are used to access a media player at specified intervals if the user wants to jump to a specific spot). I have attached all the code as a text file if more code would be helpful.

If I am following your example:

I would replace:
[CODE]// Actual code which writes the information to the other frame.
parent.frames[0].document.open();
parent.frames[0].document.writeln("<HTML><BODY BGCOLOR="#ffffff">");
parent.frames[0].document.writeln(sTempString);
parent.frames[0].document.writeln("</BODY></HTML>");
parent.frames[0].document.close();[/CODE]

with: [CODE]function update()
{
i_frame.document.writeln("updated.")
i_frame.document.writeln("<HTML><BODY BGCOLOR="#ffffff">");
i_frame.document.writeln(sTempString);
i_frame.document.writeln("</BODY></HTML>");
i_frame.document.writeln.close();
}[/CODE]


Thanks for any help. Bill

[upl-file uuid=02ba8beb-44da-43a0-b8b5-771601c34b03 size=5kB]play.txt[/upl-file]
×

Success!

Help @mechman2 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...