未捕获的引用错误: 未定义类
Uncaught ReferenceError: Class is not defined
我正在遵循此示例Create bar chart
,但有一个错误说Uncaught ReferenceError: Class is not defined
.
我已经包含了原型库.js
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.2.0/prototype.js"></script>
这是代码,
HTML:
<div id="d3area" angulard3-ear-chart datajson="'sample.json'" xaxis-name = "" xaxis-pos= "" yaxis-name="'Price/($)'" yaxis-pos="12" d3-format="'%d-%b%y'"
和指令,
应用.js:
var BarGraph = Class.create({
initialize: function(datajson,xaxisName,xaxisPos,yaxisName,yaxisPos,d3Format) {
this.datajson = datajson;
this.xaxisName = xaxisName;
this.xaxisPos = xaxisPos;
this.yaxisName = yaxisName;
this.yaxisPos = yaxisPos;
this.d3Format = d3Format;
},
workOnElement: function(element) {
},
正如我在评论中已经提到的,您应该等到所有内容(包括 Prototype.js(都加载完毕。这可以按照此处的说明完成。基本上将代码的执行与 onload 事件绑定。
相关文章:
- chrome.storage.sync未定义错误
- 对象为null或IE9中存在未定义错误
- 已定义变量出现未定义错误
- 'define' 在 RequireJS 和 Webapp Yo 生成器上未定义错误
- onreadystatechange未定义错误
- 在CoffeeScript文件上运行Jasmine测试时,对象未定义错误
- 如何修复JSlint报告的“foo未定义”错误
- 无法仅在活动服务器上读取未定义错误的属性“top”
- 主干无法读取属性'属性'主干视图中的未定义错误
- 如何克服javascript中的未定义错误
- require未定义错误
- 单击链接时出现函数未定义错误
- 函数为未定义错误
- 主干未定义错误
- 使用Javascript打印HTML:未定义错误
- 避免“无法读取”属性'获取'的未定义错误
- 未捕获类型错误的coffescription:无法读取属性'offsetWidth'的未定义错误
- ajax上get函数内部的未定义错误
- Javascript变量未定义错误
- AngularJS指令作用域未解析(“属性名称未定义”错误)