<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>Alright so I am trying to embed an IFrame into an area of a webpage.
To do this, I use XPath to get the node of their bottom bar.
Here is the code I am using:


var helpPanel = document.createElement(&quot;iframe&quot;);
helpPanel.src = &quot;http://google.com&quot;;
helpPanel.setAttribute(&quot;id&quot;, &quot;helpPanel&quot;)
helpPanel.name = &quot;helpPanel&quot;;
	
var allImgs, thisImg;
allImgs=document.evaluate(&quot;//img[@id='imgBot']&quot;,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
for (var i = 0; i &lt; allImgs.snapshotLength; i++) {
     thisImg = allImgs.snapshotItem(i);
     alert(thisImg.src);
     document.body.insertBefore(helpPanel, allImgs.snapshotItem(i));}

Now the problem I am having is that I get the alert telling me the image source, meaning everything should be a go. However no page appears. I went over to the error console and I got this message &quot;Node was not found&quot; for the last line.

Im quite puzzled because if its displaying that alert, as it is, then the node Should be found, right?</body>
  <body-html>&lt;p&gt;Alright so I am trying to embed an IFrame into an area of a webpage.
&lt;br /&gt;To do this, I use XPath to get the node of their bottom bar.
&lt;br /&gt;Here is the code I am using:&lt;/p&gt;

&lt;p&gt;var helpPanel = document.createElement(&quot;iframe&quot;);
&lt;br /&gt;helpPanel.src = &quot;http://google.com&quot;;
&lt;br /&gt;helpPanel.setAttribute(&quot;id&quot;, &quot;helpPanel&quot;)
&lt;br /&gt;helpPanel.name = &quot;helpPanel&quot;;
&lt;br /&gt;	
&lt;br /&gt;var allImgs, thisImg;
&lt;br /&gt;allImgs=document.evaluate(&quot;//img[@id='imgBot']&quot;,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
&lt;br /&gt;for (var i = 0; i &amp;lt; allImgs.snapshotLength; i++) {
&lt;br /&gt;     thisImg = allImgs.snapshotItem(i);
&lt;br /&gt;     alert(thisImg.src);
&lt;br /&gt;     document.body.insertBefore(helpPanel, allImgs.snapshotItem(i));}&lt;/p&gt;

&lt;p&gt;Now the problem I am having is that I get the alert telling me the image source, meaning everything should be a go. However no page appears. I went over to the error console and I got this message &quot;Node was not found&quot; for the last line.&lt;/p&gt;

&lt;p&gt;Im quite puzzled because if its displaying that alert, as it is, then the node Should be found, right?&lt;/p&gt;</body-html>
  <created-at type="datetime">2008-08-04T02:39:10Z</created-at>
  <forumable-id type="integer">1</forumable-id>
  <forumable-type>Forum</forumable-type>
  <id type="integer">11290</id>
  <topic-id type="integer">3020</topic-id>
  <updated-at type="datetime">2008-08-04T02:39:10Z</updated-at>
  <user-agent nil="true"></user-agent>
  <user-id type="integer">61795</user-id>
</post>
