How to change the window.Location of a frame

Asked

Viewed 468 times

6

I was wondering if it is possible to insert a target here:

window.location='www.google.com';

I don’t want to open on a new page, otherwise I would use window.open. I want to use a target="topFrame" to control a player.

I’m using an old thing (Frameset). I’m using this in the link <a href="system/radio/on.php" target="topFrame">.

  • 1

    If you’re wearing a Frame, have tried using the attribute src of the same? You can also manipulate the Frame using the API: https://developer.mozilla.org/en-US/docs/Web/API/Window.frames.

  • 2

    You can change the location of Frame (if it is of the same domain) using the DOM object of Frame. If you don’t have to use the attribute src his.

  • 1

    Thank you, for what you said here I searched on top of some tips of yours and found http://javascript.about.com/library/bltarget.htm

  • @Wakim Don’t want to post an answer explaining this better? For me is the correct answer.

1 answer

6


Well, here’s the solution I found.

How I was using

<a href="system/radio/on.php" target="topFrame"> <div class="icone_som_um"> </a>

How I’m using it now

function tocar() {
    top.frames['topFrame'].location.href = 'system/radio/on.php';
}

I’m triggering the function on js like this

<div class="icone_som_um" onClick="tocar()">
  • 2

    I know how you are using this Frameset, many web radios use, this topic will be very useful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.