SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why is this not a function?

    I keep getting an error on a JS I'm trying to create that says a function is not a function. I've tried both "Name.DoThis.methodName" and just "this.methodName", but both give the same error. Other functions work fine.

    I had to change some stuff around, but you can get the general idea of what I'm doing. How do I fix this so it calls the method properly?

    Code:
    Name.DoThis.prototype = {
    
    	init: function() {
    		// stuff
    	},
    
    	methodName : function (id, name) {
    		if (this = 'something') {
    			window.setTimeout("Name.DoThis.methodName('" + id + "', " + name + ")", 1000);
    		}
    	},
    
    	// etc. etc.
    John Saunders

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Classic error:
    Code:
    if (this = 'something') {
    should be:
    Code:
    if (this == 'something') {


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •