tags:

views:

46

answers:

2
var Card = YClass.extend({
 // define Class Name
 className:'Card', 
 // class level default options
 config:{
  id:'cardid', 
  container:'body',   // id of container in which to render the user
  render:false,
  template: 'tmpl_card',  // id of template used to render user
  debug:false   
 },
setposition:function() {
  var i=1;
  var xpos=10;
  var ypos=15;
  var recvflag=false;
}
);

how i can call set position function i am trying by Card.setposition();

but its giving me error that setposition is not defined why??

+2  A: 

It's not really a jQuery thing, it's a YClass thing. I don't know what YClass is, but my guess is that it defines classes, which you then make instances of:

var c = new Card();
c.setposition();

This would be similar to Resig's "Simple JavaScript Inheritance" Class thing, Prototype's Class object, or the system I describe here.

If you just want a container with some functions on it, you can just do that directly:

var Card = {
    setposition: function() {
        alert("Hi there!");
    };
};
Card.setposition(); // alerts "Hi there!"

...but I'm guessing you're using YClass for a reason.

T.J. Crowder
A: 
Zango
Why did you give me minus? :)
Zango