这段jquery入门代码,书上的,不能运行,新手求救
<html>
<head>
<title>jQuery - Hello jQuery</title>
<script src="Static/common/js/jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript">
var thisPage = {
initialize: function () {
this.initializeDom();
this.initializeEvent();
},
initializeDom: function () {
this.$btnShow = $("#btnShow");
},
initializeEvent: function () {
this.$btnShow.bind("click", function(event) {
$("#divMsg").toggle(300);
});
}
}
$(thisPage.initialize());
</script>
</head>
<body>
<input id="btnShow" type="button" value="Say Hello to jQuery world" />
<div id="divMsg" style="border:1px dotted #3c3c3c; display:none; width:400px;">Hello jQuery!</div>
</body>
</html>
------解决方案--------------------JScript code
//$(thisPage.initialize());
$(function(){thisPage.initialize()});
//或者
$(document).ready( function() {
thisPage.initialize();
});
------解决方案--------------------
那是因为对象调用的时候还不存在