JavaScript How to open window in frame open window framed art,open window frame clipart,window open

I learn JavaScript now, and encounter with next problem: I have page with some frames, and I want to load some page into one of specified frames; But code below does not do what I want.

Could you suggest please how could I load any url into specified frame?

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8"/>
    <title>Frameset Example</title>
</head>
<script>
    //"use strict";
    function print(str) {
        document.write("<p><pre>" + str + "</pre></p>");
    }

    window.open("http://www.google.com", "topFrame");
</script>
<frameset rows="160,*">
    <frame name="topFrame">
    <frameset cols="50%,50%">
        <frame name="leftFrame">
        <frame name="rightFrame">
    </frameset>
</frameset>
<body>
</body>

Answer:1

In order to open a page within a frame, set the src attribute of the frame to the desired url.

<frame src="whateversite.html">

Note that frames are obsolete in HTML5. Consider using an iframe to accomplish the same task, or jquery's load function iframe: https://www.w3.org/wiki/HTML/Elements/iframe jquery load: http://api.jquery.com/load/

Answer:2

Seems that I found why url does not loaded into frame 1) script is loaded before frames and it does not know about topFrame 2) I could do this loading from child frames for example like this

MainWindow.html:

<!--<!DOCTYPE html>-->  
<html lang=" EN" XMLNS="http://www.w3.org/1999/xhtml">
<head>
    <title>Frameset Example</title>
</head>
<frameset rows="160,*">
    <frame src="frame.html" name="topFrame"/>
    <frameset cols="50%,50%">
        <frame src="frame.html" name="leftFrame"/>
        <frame src="frame.html" name="rightFrame"/>
    </frameset>
</frameset>
<body>
</body>

frame.html:

<!DOCTYPE html>
<html>
<head>
    <title>Frameset Example</title>
    <script>   
        window.open("http://korrespondent.net", "leftFrame");
    </script>
</head>
<body>
</body>
</html>

But I still have question: how to run the script from MainWindow.html? I want put next script into somewhere in MainWindow.html:

<script>   
    window.open("http://korrespondent.net", "leftFrame");
</script>

But it does not work

Answer:3

I have several cases on my software where I have an array of observables and I need to execute them in order. Having the next subscription to happen only after the previous is complete. So Im using ...

I have several cases on my software where I have an array of observables and I need to execute them in order. Having the next subscription to happen only after the previous is complete. So Im using ...

  1. concat observable array
  2. merge array observable
  3. rxjs concat array of observables
  4. angular concat array of observables

I've made a game with JavaScript where a player can only guess a random number from 1 to 10 three times, each time the program reads a wrong answer it displays what should've been the right answer, ...

I've made a game with JavaScript where a player can only guess a random number from 1 to 10 three times, each time the program reads a wrong answer it displays what should've been the right answer, ...

  1. phd program right after undergraduate
  2. mba program right after undergrad
  3. nurse practitioner program right after bsn

In my site I have a switch between a down arrow & and an up arrow. See here How do I change this to a CSS transition, so there's a brief break between the switch? Here's my code: function ...

In my site I have a switch between a down arrow & and an up arrow. See here How do I change this to a CSS transition, so there's a brief break between the switch? Here's my code: function ...

When hitting https://login.salesforce.com/services/oauth2/token, using Postman. POST https://login.salesforce.com/services/oauth2/token Response: I receive a token, but when I try to do something ...

When hitting https://login.salesforce.com/services/oauth2/token, using Postman. POST https://login.salesforce.com/services/oauth2/token Response: I receive a token, but when I try to do something ...