最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么運行出來是黑色的,都找了一周的問題

<!DOCTYPE?html>
<html>
<head>
????<title></title>
????<meta?charset="utf-8">
????<style?type="text/css"></style>
</head>
<body>
????<canvas?id="canvas"style="border:1px?solid?#aaa;display:block;margin:50px?auto;"></canvas>
????<script>
????????window.onload=function(){
????????????var?canvas=document.getElementById("canvas");
????????????canvas.height=768;
????????????canvas.width=1024;
????????????var?context=canvas.getContext("2d");

????????????drawRect(context,100,100,400,400,20,"green","red");

????????}

????????function?drawRect(cxt,x,y,width,height,borderWidth,borerColor,fillColor){
????????????cxt.beginPath();
????????????cxt.moveTo(x,y);
????????????cxt.lineTo(x?+?width,y);
????????????cxt.lineTo(x?+?width,y?+?height);
????????????cxt.lineTo(x,y?+?height);
????????????cxt.lineTo(x,y);
????????????cxt.closePath();
????????????
????????????cxt.lineWidth="borderWidth";
????????????cxt.fillStyle="fillColor";
????????????cxt.strokeStyle="borerColor";

????????????
????????????cxt.fill();
????????????cxt.stroke();
????????}
????????
????</script>
</body>
</html>


http://img1.sycdn.imooc.com//5610bd630001d61415560984.jpg

正在回答

3 回答

cxt.fillStyle=fillColor;
cxt.strokeStyle=borerColor;

fillColor和borerColor是變量,不能用引號。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

逆向的藝術(shù) 提問者

真是太感謝了!我這眼睛怎么就發(fā)現(xiàn)不了呢!
2015-10-04 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Y_du 回復(fù) 逆向的藝術(shù) 提問者

對代碼不熟悉,多寫寫就好了
2015-10-04 回復(fù) 有任何疑惑可以回復(fù)我~
cxt.lineWidth=borderWidth;

這個也是相同的問題

0 回復(fù) 有任何疑惑可以回復(fù)我~

真的是完全檢測不出bug,好憂傷

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么運行出來是黑色的,都找了一周的問題

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號