【发布时间】:2010-02-13 16:25:37
【问题描述】:
我正在尝试在我的页面中使用不同的加载 JavaScript,但我无法让他们说话。
<html>
<script type="text/javascript" src="jquery144.js"></script>
<script type="text/javascript" src="shared_functions.js"></script>
<script type="text/javascript" src="page_function_callers.js"></script>
</html>
// shared_functions.js
$(document).ready (function () {
function sayHello (what) {
alert (what);
}
});
// page_function_callers.js
$(document).ready (function () {
$("div.my_button").click (function () {
sayHello ("Hello world!");
});
});
我使用 jQuery,我想使用这种方式,因为它可以让我回收许多公共方法。我哪里错了?
【问题讨论】:
标签: javascript jquery function-calls