国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

JS畫線(實例代碼)

2019-11-20 21:38:56
字體:
來源:轉載
供稿:網友

IE下畫線

復制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <style type="text/css">  
  v/:* { behavior:url(#default#VML); }  
  </style>
</head>
<body>
<v:line 
from='200,200' 
to='300,100' 
style='position:absolute;z-index:8'> 
</v:line> 
</body>
</html>

<script>
var R =function(){};
R.prototype.createLine = function (startX,startY,endX,endY){ 
  var le = document.createElement( "<v:line><v:line>" ); 
  le.from = startX + ',' + startY ; 
  le.to = endX + ',' + endY ; 
  le.strokecolor= "red" ; 
  le.strokeweight= "1pt" ; 
  return le; 

var d =new R();
document.body.appendChild(d.createLine(1,1,200,100));
</script>


FF下畫線
復制代碼 代碼如下:

<html>
  <head>
  <title>A canvas fillRect, strokeRect and clearRect example</title>
  <meta name="DC.creator" content="Kamiel Martinet, http://www.martinet.nl/">
  <meta name="DC.publisher" content="Mozilla Developer Center, http://developer.mozilla.org">
  <script type="text/javascript">
  function drawShape(){
  // get the canvas element using the DOM
  var canvas = document.getElementById('tutorial');

  // Make sure we don't execute when canvas isn't supported

  if (canvas.getContext){

  // use getContext to use the canvas for drawing
  var ctx = canvas.getContext('2d');

  // Draw shapes
  ctx.fillRect(25,25,100,100);
  ctx.clearRect(45,45,60,60);
  ctx.strokeRect(50,50,50,50);

  ctx.beginPath();
  ctx.moveTo(100,100);
  ctx.lineTo(200,250);
  ctx.lineTo(50,250);
  ctx.closePath();
  ctx.stroke();

  } else {
  alert('You need Safari or Firefox 1.5+ to see this demo.');
  }
  }
  </script>
  <style type="text/css">
  </style>
  </head>

  <body onload="drawShape();">
  <div>
  <canvas id="tutorial" width="400" height="400"></canvas>
  </div>
  </body>
</html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 石渠县| 萍乡市| 宜昌市| 新龙县| 广南县| 潞城市| 郎溪县| 嘉定区| 钟山县| 资讯 | 兴和县| 调兵山市| 秭归县| 原阳县| 隆回县| 丰都县| 广河县| 泽库县| 合川市| 宽城| 信阳市| 松滋市| 东兴市| 南召县| 台中市| 忻城县| 会东县| 克东县| 陆丰市| 武山县| 凤冈县| 平昌县| 桑日县| 通榆县| 维西| 福鼎市| 昆明市| 诸城市| 阜平县| 深圳市| 兴仁县|