html5不支持script的属性,html5 – SCRIPT438:对象不支持IE 9以下版本中的属性或方法’getContext’...

我使用canvas元素与text一起绘制曲线.它在chrome,Firefox,IE 9中运行良好.但是在IE 8,7中这不起作用.显示错误如:

SCRIPT438: Object doesn’t support property or method ‘getContext’

在IE 9以下版本中.

我在谷歌搜索然后我发现Excanvas.js会找出这个问题,但没有使用excanvas.js,我仍然得到同样的错误.

请帮我.

谢谢.

`

`

我的html画布代码:

我的js代码:

function drawTextAlongArc(context,str,centerX,centerY,radius,angle)

{

var len = str.length,s;

context.save();

context.translate(centerX,centerY);

context.rotate(-1 * angle / 2);

context.rotate(-1 * (angle / len) / 2);

for(var n = 0; n < len; n++) {

context.rotate(angle / len);

context.save();

context.translate(0,-1 * radius);

s = str[n];

context.fillText(s,0);

context.restore();

}

context.restore();

}

var canvas = document.getElementById('myCanvas'),context = canvas.getContext('2d'),centerX = canvas.width / 2,centerY = canvas.height + 40,angle = Math.PI * 0.8,radius = 250;

context.font = 'bold 30pt Ubuntu';

context.textAlign = 'center';

context.fillStyle = 'orange';

context.strokeStyle = '#336699';

context.lineWidth = 10;

drawTextAlongArc(context,'Sustainable Skill Solutions',angle);

// draw circle underneath text

context.arc(centerX,radius +70,2 * Math.PI,false);

context.stroke();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值