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 8693217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:29:55+00:00 2026-06-13T00:29:55+00:00

I have a button where in the code behind I add a onclick and

  • 0

I have a button where in the code behind I add a onclick and I pass a unique ID which will be passed to the js function. The id starts with a 0.

It wasn’t working and eventually I figured out that the number, id, it was passing was wrong…

Ie. see this: js fiddle

It works with a ‘ at the start and end of the number. Just wondering why 013 turns to 11. I did some googling and couldn’t find anything…

Cheers

Robin

Edit:

Thanks guys. Yep understand now.

As in this case the 0 at the start has a meaning, here the recipient ID in a mailing list, I will use ‘013’ instead of just 013, i.e. a string. I can then split the values in js as each of the 3 values represents a different id which will always be only 1 character long, i.e. 0-9.

  • 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-13T00:29:56+00:00Added an answer on June 13, 2026 at 12:29 am

    A numeric literal that starts with a 0 is treated as an octal number. So 13 from base 8 is 11 in base 10…

    Octal numeric literals have been deprecated, but still work if you are not in strict mode.

    (You didn’t ask, but) A numeric literal that starts with 0x is treated as hexadecimal.

    More info at MDN.

    In your demo the parameter is called id, which implies you don’t need to do numerical operations on it – if so, just put it in quotes and use it as a string.

    If you need to be able to pass a leading zero but still have the number treated as base 10 to do numerical operations on it you can enclose it in quotes to pass it as a string and then convert the string to a number in a way that forces base 10, e.g.:

    something('013');
    
    function something(id){    
        alert(+id);             // use unary plus operator to convert
        // OR
        alert(parseInt(id,10)); // use parseInt() to convert        
    }
    

    Demo: http://jsfiddle.net/XYa6U/5/

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

Sidebar

Related Questions

I have the following code behind a button in Visual Studio 2010 private void
I am trying to add a code behind the add button my code is
I have an Asp server control button for which I have onClick for processing
In my Asp.net website I have a repeater which loads dynamically from code-behind. In
I have a simple function that I want to call in the code behind
I have this code and I want to have my button as a square,
I have this code that has one button that let's me choose an entry
I have code that works great for adding a button to the toolbar: NSArray*
i have this code in the button click to show selection image when the
I have this code for changing the image of a button: - (void)mouseEntered:(NSEvent *)event

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.