<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Raphael绘制线段</title>
<style>
#myline{
border: 1px solid red;
width: 200px;
height: 200px;
}
</style>
<script src="js/raphael.js"></script>
<script>
function createLine(){
var root=document.getElementByIdx_x("myline");
var paper=Raphael(root,200,200);
var line=paper.path("M10 20L180 180");
//指定颜色
line.attr("stroke","blue");
}
</script>
</head>
<body οnlοad="createLine()">
<h3>Raphael绘制线段</h3>
<div id="myline"></div>
</body>
</html>