我正在尝试在我的页面中加载不同的内容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,我想使用这种方式,因为它可以让我回收许多公共方法。我哪里错了?