在 IE 7/8 浏览器和文档模式下运行以下代码时,我收到错误消息“对象不支持属性或方法‘格式’”。我正在使用 Knob - jQuery 插件。
// Dial logic
var Dial = function (c, opt) {
var v = null
,ctx = c[0].getContext("2d")
,PI2 = 2 * Math.PI
,mx ,my ,x ,y
,self = this;
this.onChange = function () {};
this.onCancel = function () {};
this.onRelease = function () {};
this.val = function (nv) {
if (null != nv) {
opt.stopper && (nv = Math.max(Math.min(nv, opt.max), opt.min));
v = nv;
this.onChange(nv);
this.draw(nv);
} else {
var b, a;
b = a = Math.atan2(mx - x, -(my - y - opt.width / 2)) - opt.angleOffset;
(a < 0) && (b = a + PI2);
nv = Math.round(b * (opt.max - opt.min) / PI2) + opt.min;
return (nv > opt.max) ? opt.max : nv;
}
};