Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually the value of <code>id</code> is changed, but <code>document.writeln()</code> is not in the <code>link</code> function, hence it's not executed.</p> <p>A quick-fix would be to move the <code>document.writeln()</code> into <code>link()</code>, but that would be a disastrous fix. <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document.write" rel="nofollow"><code>document.write(ln)()</code></a> wipes out everything in the document, and creates a new one, when used after the page has been parsed. You need to do something like this:</p> <pre><code>function link() { id = 'http://www.example.org'; document.getElementById('heel').src = id; } </code></pre> <p>Then add your iframe element to a HTML, and remove the whole script with <code>document.writeln()</code>.</p> <pre><code>&lt;iframe id="heel" name="heel" src="http://www.example.com" height="300" width="700"&gt;&lt;/iframe&gt; </code></pre> <hr> <p><strong>EDIT</strong></p> <p>If you want to create a new <code>iframe</code> element, you can do it like this:</p> <pre><code>function link() { var frame = document.createElement('iframe'); // creates an iframe element id = 'http://www.example.org'; frame.width = '700px'; // sets the width for the new iframe frame.height = '300px'; // sets the height for the new iframe frame.name = 'heel2'; // sets the name for the new iframe frame.src = id; // sets the src for the new iframe document.body.appendChild(frame); // appends the new iframe to body as a last element } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload