2014-02-09 194 views
0

我是JavaScript新图形编程新手,我正在尝试Raphael库。我试图展示一个简单的圆圈,但只获得一个空白页面。这里是源代码:Raphael JavaScript显示空白页

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"/> 
    <title> Raphael JS Test </title> 

     <script src="raphael.js"></script> 
     <script> 
      window.onload = function() { 
       var p = Raphael(10, 10, 400, 400); 
       p.circle(100, 100, 45); 
      } 
    </script> 
</head> 

<body> 
</body> 
</html> 

所有帮助非常感谢!谢谢!

回答

1

我认为这个圆圈出现在页面上,但它是白色的,在白色背景上有白色笔画。你有没有尝试设置一种颜色

// Sets the fill attribute of the circle to red (#f00) 
circle.attr("fill", "#f00"); 

// Sets the stroke attribute of the circle to white 
circle.attr("stroke", "#fff"); 
+0

我都尝试和既不工作。任何其他想法? – IntegrateAllDay

+0

我只是尝试你的代码,它的工作原理。你在使用哪个导航器?不要在控制台中有任何错误? – Maxime

+0

我正在使用Safari并在Web检查器中出现错误:ReferenceError:找不到变量:Raphael – IntegrateAllDay