(function($){

$.fn.ChangeStyle
= function(options,msg){

var opts = $.extend({},$.fn.ChangeStyle.defaults, options);

this.css("background",opts.background);
this.css("color",opts.color);

//private method
Note(msg);

//public method
$.fn.ChangeStyle.customAction();

};
function Note(msg)
{

if(undefined != msg)
{
alert(msg);
}
}

$.fn.ChangeStyle.defaults
= { background:"#999",color:"red"};

$.fn.ChangeStyle.customAction
= function(){};

})(jQuery);


//Invoke the pluign example
$(
function()
{

//set properties
//$(
"form").ChangeStyle.defaults.background = "#f1f1f1";
//$(
"form").ChangeStyle.defaults.color = "blue";

$(
"form").ChangeStyle.customAction = function(){ alert("this is custom action")};
$(
"form").ChangeStyle({ background:"#999",color:"red"},"hi");


});

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-07-13
  • 2021-12-08
  • 2021-11-09
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案