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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:13:58+00:00 2026-05-24T10:13:58+00:00

I have a problem with Javascript forcing the [object DOMWindow] into an function I

  • 0

I have a problem with Javascript forcing the [object DOMWindow] into an function I have in an object’s prototype. The full error I get is below:

Uncaught TypeError: Object [object DOMWindow] has no method 'positionconvert'

Basically what I’m doing is inside the object prototype under certain conditions I’m creating a var interval that counts off with window.setInterval():

var interval = window.setInterval(this.alertanimate, 500);

the alertanimate function is inside the same prototype, and uses the this variable in this line:

this.positionconvert(this.alerticon, -69, 55);

(positionconvert is yet another function, and alerticon is an object). The problem is when I get window.setInterval involved js starts assuming this is the DOM and not the object prototype, like I intended, presenting the above error. When I hard-code this to work with a specific object it works, but somewhere in this variable-passing the this variable loses its connection to the object. I hope this all makes sense? What am I doing wrong?

  • 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-05-24T10:13:59+00:00Added an answer on May 24, 2026 at 10:13 am

    Passing this.alertanimate to setIntervall loses the connection to the main object. What this refers to in a function is entirely defined by how the function is called.
    If you pass a function to setTimeout then this will refer to window.

    You can do:

    var self = this;
    
    window.setInterval(function() {
        self.alertanimate();
    }, 500);
    

    In newer browsers, you can also use .bind() [MDN] (see docs for an alternative implementation):

    window.setInterval(this.alertanimate.bind(this), 500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with a javascript error: $(#slider) is undefined How can i
I am having a problem accessing the ViewData object through javascript. I have set
I have problem calling a JavaScript function in an iframe from the parent page.
I have problem with SharePoint encoding the javascript link, that normally renders like href=javascript:Function('url');
i have problem this is javascript function its dont show the image in background.
Hi I have problem with adding javascript into a joomla module..I've found some solution,
I have a problem with my javascript code. I have this prototype and I
I have problem in some JavaScript that I am writing where the Switch statement
I have a problem with a javascript set of functions that I made. This
I have problem with dynamically created image (JavaScript). I want to change the innerHTML

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.