特效描述:html5 canvas 大转盘抽奖提示。只用canvas做出的转盘及指针,各奖项和分区颜色可随意设置。
代码结构
1. 引入CSS
2. 引入JS
3. HTML代码
抱歉!浏览器不支持。
抱歉!浏览器不支持。
抱歉!浏览器不支持。
抱歉!浏览器不支持。
window.alert = function(str)
{
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "50%";
shield.style.top = "50%";
shield.style.width = "280px";
shield.style.height = "150px";
shield.style.marginLeft = "-140px";
shield.style.marginTop = "-110px";
shield.style.zIndex = "25";
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.width = "280px";
alertFram.style.height = "150px";
alertFram.style.left = "50%";
alertFram.style.top = "50%";
alertFram.style.marginLeft = "-140px";
alertFram.style.marginTop = "-110px";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "150px";
alertFram.style.zIndex = "300";
strHtml = "
- \n";
strHtml += "
[中奖提醒]\n";strHtml += "
"+str+"\n";strHtml += "
\n";strHtml += "
\n";alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
document.body.appendChild(shield);
this.doOk = function(){
alertFram.style.display = "none";
shield.style.display = "none";
}
alertFram.focus();
document.body.onselectstart = function(){return false;};
}