/    Sign up×
Community /Pin to ProfileBookmark

How to target a javascript function in another frame?

Hi everybody,

I’m using a frameset like this:

[CODE]frameset rows=”80,*” cols=”*”>
<frame src=”title.htm” name=”topFrame”>
<frameset rows=”*” cols=”250,*” >
<frame src=”nav.htm” name=”leftFrame”>
<frame src=”home.htm” name=”mainFrame”>
</frameset>
</frameset>[/CODE]

Now I’d like do call a function named “tnm_select(p,q)” which is included in the “nav.htm” in “leftFrame” from a link in “home.htm”.

I tried this:

[CODE]function set_nav() {
parent.frames[1].document.tnm_select(p,q);
}[/CODE]

but it didn’t work.
Can anybody give me a hint?
Thanks in advance
Regards
timbuktu

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@cyber1Sep 21.2005 — timbuktu-

either of these will work

[code=html]
parent.frames[1].document.getElementById('slogan_label').innerHTML=document.editform.content_title.value;
parent.frames[1].document.getElementById('input_test').innerHTML=document.editform.content_title.value;

parent.bottom.document.getElementById('slogan_label').innerHTML=document.editform.content_title.value;
parent.bottom.document.getElementById('input_test').innerHTML=document.editform.content_title.value;

These were the fields in the bottom frame
<span id="slogan_label">NAME</span><br>
<input type="text" id="input_test" name="input_test" size="50" maxlength="5" />
[/code]


-Bill
Copy linkTweet thisAlerts:
@timbuktuauthorSep 21.2005 — Hi cyber1,

sorry, seems I didn't specify properly.

I do not want to target a form tag.

I want to call a [B]javascript function[/B]:

[CODE]function test() {
MM_nbGroup('down','navbar1','nav_ehrenkodex_r3_c1','images_ehrenkodex/nav_ehrenkodex_r3_c1_f3.gif',1);
}[/CODE]


which is located in the HTML document "nav.htm" in the "leftFrame" of my frameset.

How can I call this function from another HTML document ("home.htm") located in the "mainFrame" of the frameset?

Rgds

timbuktu
Copy linkTweet thisAlerts:
@UltimaterSep 21.2005 — No document. Also make sure that you are actually passing values to your function.

<i>
</i>function set_nav() {
parent.frames[1].tnm_select("somthing","anothersomething");
}
Copy linkTweet thisAlerts:
@timbuktuauthorSep 21.2005 — thanks Ultimater, that did it.

Rgds

timbuktu
×

Success!

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