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

The Archive Base Latest Questions

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

I know I might be doing something wrong. Can anyone please point out why

  • 0

I know I might be doing something wrong. Can anyone please point out why I’m getting top as object??

$(document).ready(function(){
    topwithpx='0px';
    alert(topwithpx);
    topstr=topwithpx.substr(0,topwithpx.length-2);
    alert(topstr);
    top=parseInt(topstr);
    alert(top);
});​

http://jsfiddle.net/kjMs9/

Thanks all: ‘top’ is reserved keyword (Window.top). My bad. Accepting first ans. +1 to all for quick ans.

  • 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-10T03:29:16+00:00Added an answer on June 10, 2026 at 3:29 am

    Because it’s essentially window.top, which is Window object. Use var top instead to prevent mixing local variable with global (= properties of window object) ones.

    In fact, make var-ing your function variables something of a common routine – to prevent getting similar gotchas in the future. )

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

Sidebar

Related Questions

I know this is something I'm probably doing wrong, so please don't incinerate me
Know this might be rather basic, but I been trying to figure out how
I know this might seem like a duplicate, but I'm not getting anywhere with
Environment .NET 3.5 Self Servicing LLBL Pro 2.6 I know I might be doing
I know this might be a bit of a silly question, probably doing it
Anyone pretty familiar with FTP 7.5 extensibility in IIS know what I might be
I can't seem to get a custom action working. I might be doing this
Be aware that I might be doing this totally wrong, so I apologize in
Maybe I'm doing something really wrong, but somehow this code always crashes with a
I am considering doing something that might seem strange to get a reliable time

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.