为什么的设置canvas.weight时宽度不能变大,一直是这么大
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <!DOCTYPE html> < html > < head > < meta charset = "utf-8" > < title >canvas</ title > </ head > < body > < canvas id = "canvas" style="display:block;margin:10px auto; border:1px solid #aaa;"></ canvas > < script > window.onload = function() { var canvas=document.getElementById('canvas'); var context=canvas.getContext('2d'); canvas.weight = 1000; canvas.height = 300; context.beginPath(); context.moveTo(20,20); context.lineTo(200,100); context.closePath(); context.lineWidth=5; context.stroke(); } </ script > </ body > </ html > |