The Function Works But Reports this.refresh() is not a function

Posted by ren1999 on Stack Overflow See other posts from Stack Overflow or by ren1999
Published on 2011-01-29T15:17:47Z Indexed on 2011/01/29 15:25 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

I get this.refresh() is not a function in the error log every time I use this function but it works fine.

Also, when I click on this function for the first time, this.value=undefined. When I click the function again in this form and every other form, the value populates just fine with the previous value.

What could I be doing wrong?

How do I write this function more efficiently?

I still don't quite understand how to use this.value to capture and store a value within an array. Please notice that I added ---- where there should be a '----<' to be able to display the code.

function askGender(x)
 {response="----select class=widgetstyle onClick=_setGender(this.value)>----option value=Female>Female----option value=Male>Male";
   characters[x].setGender(response);
    if(this.gender!=0)
     {response=this.gender;
      this.gender=0;
      characters[x].setGender(response);
     }
 }
function _setGender(x)
 {this.gender=x;
  this.refresh();
 }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about refresh