var mymessage=(function(){function message(setting){this.messagecontainer=null;this.opts=null;this._setting(setting);this.init();} message.defaults={iconfontsize:"20px",messagefontsize:"20px",showtime:3000,align:"center",positions:{top:"10px",bottom:"10px",right:"10px",left:"10px"},message:"这是一条消息",type:"normal",} message.prototype._setting=function(setting){this.opts=$.extend({},message.defaults,setting);} message.prototype.setting=function(name,val){if("object"===typeof name){for(var k in name){this.opts[k]=name[k]}}else if("string"===typeof name){this.opts[name]=val;}} message.prototype.init=function(){var domstr="
" this.messagecontainer=$(domstr);this.messagecontainer.appendto($('body'))} message.prototype.add=function(message,type){var domstr="";type=type||this.opts.type;domstr+=" ";var $domstr=$(domstr).appendto(this.messagecontainer);this._hide($domstr);} message.prototype._hide=function($domstr){settimeout(function(){$domstr.fadeout(1000);},this.opts.showtime);} return{message:message}})();