我有以下脚本。从那我需要调用参数对象内部的函数。让我们说" onOpen
"可能吗?我试图从" callIt
"但它不起作用,所以我怎么做。
<html>
<head>
<title>Object With Arguments</title>
<script src="http://code.jquery.com/jquery-2.1.1.js"></script>
</head>
<body onload="callIt()">
<script type="text/javascript">
$.fn.myPlugin = function (settings) {
var options = jQuery.extend({
name: "MyPlugin",
target: document,
onOpen: function () {
document.write('on open');
},
onClose: function () {},
onSelect: function () {}
}, settings);
document.write(options.name + '<br/>')
}
function callIt(){
$.fn.myPlugin.options.onOpen();
}
</script>
</body>
</html>