Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:26:04+00:00 2026-06-13T15:26:04+00:00

I am trying to make links work which we click to change the language

  • 0

I am trying to make links work which we click to change the language of website using JavaScript. Here is the HTML code:

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

and here the javascript:

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

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:26:05+00:00Added an answer on June 13, 2026 at 3:26 pm

    You can try using an ID or class to achieve the same purpose instead of name.

    Example:

    <div id="foo">This is id of foo</div>
    <div class="choo">This is class of choo</div>
    

    Then if you use ID then use:

    document.getElementById('foo');
    

    and with class use:

    document.getElementsByClassName('choo');
    

    I hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use link to submit a form using the following code:
I am trying to make a list of links, 6 links in a row.
I'm trying to make a program that, using pointers, detects lines in an image
I'm trying to make this query work, in my model Workshop I have a
I have a menu with links in the following form, in which I am
I am trying to make a website that deals with a database of students
I work for company that links out to partners through a third party website
I have an XHTML 1.0 Strict document in which I'm trying to make Shadowbox
After the form is submitted (using ajax), I'm trying to fade it out and
I'm trying to work on a project about page ranking. I want to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.