JavaScript code not working IE8
<p>I am trying to make work links which we click to change the language of website using JavaScript. Here is the HTML code:</p>

<pre><code>'&lt;form action="" method="post" name="currlang"&gt;'.
        '&lt;input type="hidden" name="languageval" value="'.$session-&gt;value("language").'"/&gt;'.
        '&lt;a onclick="langa(this, \'en\');" class="langs'.($session-&gt;value("language")=='en'?" active":"").'" id="en"&gt;&lt;/a&gt;'.
        '&lt;a onclick="langa(this, \'it\');" class="langs'.($session-&gt;value("language")=='it'?" active":"").'" id="it"&gt;&lt;/a&gt;'.
        '&lt;a onclick="langa(this, \'pl\');" class="langs'.($session-&gt;value("language")=='pl'?" active":"").'" id="pl"&gt;&lt;/a&gt;'.
    '&lt;/form&gt;'.
</code></pre>

<p>and here the javascript:</p>

<pre><code>function langa(obj, valu) {
    document.getElementsByName("languageval")[1].value=valu;
    document.getElementsByName('currlang')[1].submit();
}
</code></pre>

<p>The script works fine on new browsers (Firefoxe, Opera, Chrome, IE9) but when testing it on IE8 it gives an error "'document.getElementsByName(...).1' is null or not an object".
After some research I found out that getElementsByName() is not supported by IE8 and above and maybe the solution would be to use jQuery and this is where I need help.
How can I make this work with jQuery or without it?</p>

<p>Thank you so much for your help.</p>
