mootools class 定义

Mootols 中定义class的时候, options中的最后一个选项后面要避免出现分隔号”,”, 同样 function后面没有内容了,也不需要再加逗号了, 否则IE7下js会报错

var request_finance = new Class({
    Implements: [Options, Events],
   
    options: {
        url: ‘/action/main/requestfinance/’,
        method: null
    },
   
    initialize: function(options){
       
        this.setOptions(options);
        this.OpenSession();
        this.ScaleInfoAB();
    },
   
    // initialize web service method
    initializeParams: function(params){
       
        if(typeof(params) == ‘object’)
        {
            return JSON.encode(params);
        }
        else
        {
            return ”;
        }
    },
   
    sendRequest: function(valMethod, valPrefix, fctSuccess, params){
        if(params == undefined || params == null)
        {
            params = ”;
        }
       
        new Request.JSON({
            url: this.options.url,
            method: ‘post’,
            data: {params: this.initializeParams(params), method: valMethod, paramPrefix: valPrefix},
            onSuccess: fctSuccess
        }).send();
       
    },

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s