我有此脚本:如何解决在JavaScript中未定义的属性?
var Tord = (function() {
Tord.prototype.getHeader = function() {
alert('test');
};
return Tord;
})();
$(document).ready(function() {
var tod = new Tord();
tod.getHeader();
});
我得到一个错误Uncaught TypeError: Cannot read property 'prototype' of undefined
线3
我不明白为什么?
,这里是我的js文件的加载方式:
<link rel="stylesheet" href="public/jquery.mobile/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="public/style.css" />
<script src="public/jquery-1.8.3.min.js"></script>
<script src="public/jquery.mobile/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="public/cordova-2.2.0.js"></script>
<script type="text/javascript" charset="utf-8" src="public/script.js"></script>
script.js
有脚本从上面。
有什么想法?谢谢。
Tord不应该自行调用。 – Christoph