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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:51:03+00:00 2026-05-11T05:51:03+00:00

Using JQuery 1.2.6, testing from Firefox 3 and IE7. I have a very basic

  • 0

Using JQuery 1.2.6, testing from Firefox 3 and IE7. I have a very basic bit of JavaScript to reload a captcha image. In my JS file, I have:

var Captcha = {     count: 0,      Refresh: function(){         // Concatenate 'count' to force a URL change, which forces the browser to reload the image         $('#Captcha').attr('src', 'Captcha.aspx?' + Captcha.count);         Captcha.count++;     } } 

My link looks as follows:

<a href='javascript:void(0);' id='ChangeCaptcha' onclick='Captcha.Refresh();'>Try a different image</a> 

When I click on the link, I get a JavaScript error. From the Firebug plugin for Firefox, it says ‘Captcha.Refresh’ is not a function. So, I go to my Firebug console in the same window, and type

Captcha 

And I get an ‘object’ in the response line (as expected). I then type

Captcah.Refresh 

And I get a function() in the response line (as expected). I then type

Captcha.Refresh() 

And it executes the function, updates my captcha image, everything is dandy. If I go back and try the link again, it still does not work. If I type in Capcha.Refresh() into the console without ever hitting the link, it also works fine. What on earth am I missing here? Clearly the JS is getting loaded, but why doesn’t that function call work?

  • 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. 2026-05-11T05:51:03+00:00Added an answer on May 11, 2026 at 5:51 am

    The problem arises because you have an element with an id of Captcha, and a global variable with the same name. IE traditionally introduces a global variable for every id attribute. FF doesn’t… but pretends it does in certain situations for compatibility with IE. In this case, the click handler sees Captcha as an element rather than your object.

    Work-arounds:

    Change the id of the Captcha element.

    Or, change the name of your global object to something other than Captcha.

    Or, use Pim Jager’s technique to move interpretation of the handler into a context where the global Captcha variable has been overwritten with your own.

    Or, change your onclick attribute to:

    onclick="window.Captcha.Refresh();" 

    …this will force lookup of the Captcha property in the context where it has been replaced by your global variable.

    (all of these tested in IE6 and FF3 – i recommend Pim Jager’s answer)

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

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 177k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Tabs in a Ribbon shouldn't change the view. The Ribbon… May 12, 2026 at 3:22 pm
  • Editorial Team
    Editorial Team added an answer Searching and reading some blog postings and forum posts on… May 12, 2026 at 3:22 pm
  • Editorial Team
    Editorial Team added an answer I switched to notepad++ when I had the same kind… May 12, 2026 at 3:22 pm

Related Questions

I have a simple webmethod on an asp.net 2.0 application (using the 1.0 extensions
I am using a jQuery plugin to set cookies and when I use localhost
I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery
I have a snippet of code that I'm working with to filter rows in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.