Return clickable URL from text URL in JavaScript
<p>I'm working on a cascading dropdown list. When the last item is selected, it pulls up info from a .cs list based on all of the previous selections. This is working well. However, I would like the displayed results to include a clickable link as well as the other info. Right now I'm using document.write to open a new window with the link on it. This is not ideal.</p>

<pre><code>    function formatHyper(hyper) {
    var NewWindow = window.open('', 'name', 'height=660,width=650,status=1');
    var str = "Parts";

    NewWindow.document.write(str.link(hyper));

}
</code></pre>

<p>Hyper is the text link. Being called from an external .cs file that looks like this:</p>

<pre><code>public class PhonePrice
{
private static List&lt;Phone&gt; Phones = new List&lt;Phone&gt;{
    new Phone{Make="Apple",Model="iPhone    4",Carrier="ATT",Colour="black",Price=00.00f,Hyper="http://www.google.com"},
</code></pre>

<p>When I complete the last dropdown selection it will display info about my selection but it then opens a new window with just the link. If I remove the NewWindow variable, it will load just the link in the current page, thus making it to where I can't see any of the other returned data. </p>

<p>I would like it to work like the currency does. But instead of adding a $ I want it to convert the text into a URL</p>

<pre><code>    function formatPrice(price) {
    return "$" + price.toFixed(2);
}
</code></pre>

<p>Here is what it looks like when it opens the clickable link in a new window. I would like the clickable link to appear where it says undefined.</p>

<p><strong>Apple iPhone 4<br>
Carrier ATT<br>
Colour: black<br>
Hyper: undefined<br>
Price: $00.00</strong></p>

<p>Please help!!</p>

<p><a href="http://www.2shared.com/file/fFgPZGQm/CDD.html" rel="nofollow">Here's a link to the full code</a></p>
