javascript link inside span
<p>I'm trying to add a link to a span of text using Javascript below. Please help.</p>

<pre><code>&lt;div id="features"&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;div id="emma2011_left"&gt;
&lt;h2&gt;Image of the Day&lt;/h2&gt;
&lt;div id="dImg"&gt;
&lt;div id="dailyimg" class="feature"&gt;&lt;/div&gt;
&lt;div id="title" class="feature"&gt;&lt;/div&gt;
&lt;div id="caption" class="feature"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span id="span" class="feature"&gt;&lt;a id="pidlink"&gt;Link to the object&lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;


 &lt;script type="text/javascript"&gt;

 ...
 link = document.createElement("a");
 link.setAttribute("href", "http://abc.org/index.aspx?objectid=" + oTodayImage.pid);
 var span = document.createElement("span");
 var txt = link.href;
 var textNode = document.createTextNode(txt);
 span.appendChild(textNode);
 &lt;/script&gt;
</code></pre>
