What is the bug in this javascript code using Raphael.js?
<html>
<body>
<script src="raphael.js" type="text/javascript"></script>
<script>// Each of the following examples create a canvas that is 320px wide by 200px high
// Canvas is created at the viewport’s 10,50 coordinate
var paper = Raphael(10, 50, 320, 200);
// Canvas is created at the top left corner of the #notepad element
// (or its top right corner in dir="rtl" elements)
var paper = Raphael(document.getElementById("notepad"), 320, 200);
// Same as above
var paper = Raphael("notepad", 320, 200);
// Image dump
var c = paper.circle(50, 50, 40);
var set = Raphael(["notepad", 320, 200, {
type: "rect",
x: 10,
y: 10,
width: 25,
height: 25,
stroke: "#f00"
}, {
type: "text",
x: 30,
y: 40,
text: "Dump"
}]);开发者_Python百科
</script>
</body>
I am just testing/learning Raphael and am running this HTML code in XAMPP , in ubuntu , using Chrome Browser . But nothing is getting displayed . Though , I have the raphael.js file in the same folder of the html file .
What is the bug ?
I don't use Raphael so I don't know the inner workings, but on the first look it seems to me that you are missing an html element whoose id is notepad
. Like some container which will hold the canvas
<div id="notepad">
</div>
精彩评论