Error when trying to get document.getElementsByName(name)
<p>I have been trying to use this code in one of my projects:</p>

<p><a href="https://github.com/cemerick/jsdifflib" rel="nofollow">https://github.com/cemerick/jsdifflib</a></p>

<p>EDIT: Link to code in question <a href="http://jsfiddle.net/BvFNf/3/" rel="nofollow">http://jsfiddle.net/BvFNf/3/</a></p>

<p>The code in its current form uses:</p>

<pre><code>var byId = function (id) { return document.getElementById(id); }
    base = difflib.stringAsLines(byId("baseText").value),
    newtxt = difflib.stringAsLines(byId("newText").value),
</code></pre>

<p>However I am trying to use the name field instead:</p>

<pre><code>var byName = function (name) { return document.getElementsByName(name); }
    base = difflib.stringAsLines(byName("field1")[0].value),
    newtxt = difflib.stringAsLines(byName("field2")[0].value),
</code></pre>

<p>The append child code is as follows:</p>

<pre><code>        diffoutputdiv.appendChild(diffview.buildView({
            baseTextLines: base,
            newTextLines: newtxt,
            //opcodes: opcodes,
            baseTextName: "Base Text",
            newTextName: "New Text",
            contextSize: contextSize,
            viewType: viewType
    }));
</code></pre>

<p>I also added <code>' name="field1" '</code> to the html.</p>

<p>The full source can be found here: <a href="http://pastebin.com/7y3SQYFM" rel="nofollow">Pastebin Code</a>
The error I keep getting is:</p>

<pre><code>Uncaught TypeError: Object #&lt;NodeList&gt; has no method 'appendChild' demo.html:69
diffUsingJS demo.html:69
onclick demo.html:98
</code></pre>

<p>The data being returned is equivalent to the original byID data set. Please help.</p>
