/    Sign up×
Community /Pin to ProfileBookmark

Access Sibling Frame

Hi,

how do I access from a frame an object of another frame?

I have the following 4 html files.

[B]index.html[/B]

[CODE]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>
<html>
<header>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
</header>
<frameset rows=”*, 45px” name=”test”>
<frame src=”menu.html” name=”main” id=”main” scrolling=”yes”>
<frame src=”player.html” name=”player” id=”player” scrolling=”no”>
</frameset>
</html>
[/CODE]

[B]menu.html[/B]

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
</head>
<body >
<a href=”black.html”> GO TO SUB WEBSITE </a>
</body>
</html>
[/CODE]

[B]player.html[/B]

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html >
<head>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
</head>

<body >
<audio id=”myaudio” controls=”true” autoplay=”true” >
<source src=”#” type=”audio/mpeg” />
This text displays if the audio tag isn’t supported.
</audio>
</body>
</html>
[/CODE]

[B]black.html[/B]

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<script >
function runRadio() {
var audio = document.getElementById(“myaudio”);
audio.volume = 1;
audio.src = “https://br-br1-obb.sslcast.addradio.de/br/br1/obb/mp3/128/stream.mp3”;
audio.preload = “none”;
audio.load();
}
</script>

<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
</head>

<body >
<a href=”javascript:;” onClick=”runAudio()”>RUN</a>
</body>
</html>
[/CODE]

So by clicking the RUN link within [B]black.html[/B] I want to play the audito within [B]player.html[/B]

Thx, Aykut

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@KalemauthorJan 03.2018 — [B]black.html[/B]

onClick="[B]runAudio[/B]()"



should be



onClick="[B]runRadio[/B]()"



(my question is still not solved, how do I access id="myaudio" from another frame?)
Copy linkTweet thisAlerts:
@rootJan 03.2018 — Sorry to break this to you but Framsets were dropped years agoa nad are not supported in HTML5 which uses the <!DOCTYPE html> tag instead of the HTML4 tag
Copy linkTweet thisAlerts:
@KalemauthorJan 03.2018 — THANKS for the hints!

#1

OK, understood! => <!DOCTYPE html>

#2
>> "Sorry to break this to you but Framsets were dropped years agoa"

What should I use instead frameset in HTML5?

I want

- to change content of top_frame

- to keep content of bottom_frame
Copy linkTweet thisAlerts:
@rootJan 03.2018 — Frame sets were dropped years ago as in depreciated and HTML 5 does not recognise frame sets, only browsers that would recognise framesets are really old browsers.

So you shouldn't be using them in HTML markup.

The new accepted method is to use DIV elements which you then populate with the HTML that you want displayed there or you can use iframes but even those are going for the chop at some point and use was discouraged many years ago.

Does that clarify?
Copy linkTweet thisAlerts:
@KalemauthorJan 04.2018 — Yes, I changed my code. It works now! Thx!
×

Success!

Help @Kalem 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 4.25,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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