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

  • Home
  • SEARCH
  • 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 8455525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:18:29+00:00 2026-06-10T12:18:29+00:00

I am having a problem with a simple script that is supposed to update

  • 0

I am having a problem with a simple script that is supposed to update a page with some values(user input) that are turned from monthly to yearly (the numbers go into numeric fields created by confirmIT)

<script>
function update() {
  for (var i = 0; i < 9; i++) {
    var ans = parseInt(document.getElementById("bq10a_" + i).value, 10);
    if (!isNaN(ans)) {
      var new = ans * 12;
      document.getElementById("bq10a_" + i + "calc").value = new;
    }
  }
}
return;
}

setInterval("update()", 1000);    
</script>

this yields an Expected identifier error on line

var new = ans*12;

and i would appreciate any help on how to solve 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-10T12:18:30+00:00Added an answer on June 10, 2026 at 12:18 pm

    The word new is a reserved word in JavaScript and cannot be used as the name of a variable.

    The error means that the parser expected an “identifier”, which is to say that it expected to see a valid identifier.

    Change the name of the variable and things should improve. In the code you’ve posted I think there’s a { } nesting problem; there appears to be one too many before the return of the function.

    edit — also as jbabey notes in a comment, your setInterval() call should be

    setInterval(update, 1000);
    

    It’s not a good idea, generally, to pass strings to setInterval(), despite the advice of thousands of mouldy old instructional websites.

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

Sidebar

Related Questions

I'm having a problem with a simple html login page I made, where when
I'm having a problem getting a simple ASP.NET webpage to display. The page contains
I have a simple script that dynamically takes images from a Cloudfront bucket, resizes
I am having problems creating a simple PHP script. The $_GET[give] variable is always
I'm having a problem with a simple form where i'm attempting to fire an
Ok, so I'm having a problem with a simple textarea. I'm using a kind
hey guys having this really simple problem but cant seem to figure out have
I am having a problem setting up a simple test project for SignalR. I
I'm having a very simple problem. I'm new to WordPress and I'm trying to
I'm having a problem with a pretty simple setup in NHibernate. (I'm using Fluent

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.