分类: Java
2014-07-03 23:51:29
/* 调用方法
*/
(function ($) {
$.fn.extend({
HighLight: function (options) {
var defaults = {
key: "达奇",
color: "#ff0000"
};
var options = $.extend(defaults, options);
var key;
var pattern;
pattern = new RegExp(options.key, "g");
document.body.innerHTML = document.body.innerHTML.replace(pattern, options.key.fontcolor(options.color));
return this;
}
});
})(jQuery);