当我扩展Jquery函数时,为什么会出错?
出错这个错误:"对象不支持SetUI的属性和方法", 请帮忙。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="Js/SetUI.js" type="text/javascript"></script>
<link href="Css/SetUI.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
var aa="";
$("#MyDiv").SetUI(aa, "math");
});
</script>
</head>
<body>
<div id="MyDiv">
</div>
</body>
</html>
(function ($) {
$.fn.SetUI = function (editor, opts) {
if (opts == "math") SetMath.init(this, editor);
};
var SetMath = function (obj, editor) {
init: function () {
priv.initToolBar(SetMathOptions);
}
};
SetMathOptions = {
toolbar: [
["p", "h1", "h2", "h3", "h4", "h5", "h6"],
["cut", "copy", "paste"]
],
toolbarText: {
p: "Paragraph", h1: "Heading 1", h2: "Heading 2", h3: "Heading 3", h4: "Heading 4", h5: "Heading 5", h6: "Heading 6",
cut: "Cut", copy: "Copy", paste: "Paste"
}
};
var priv = {
initToolBar: function (options) {
}
};
})(jQuery);
------解决方案--------------------
因为juery里面没有.SetUI()这个事件。。