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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| <html>
<head>
<title>Kreis</title>
<style>
#box {
position: relative;
left: 600px;
top: 200px;
}
.punkt {
position: absolute;
width: 1px;
height: 1px;
background-color: blue;
}
</style>
</head>
<body>
<div id="box"></div>
<script>
var oBox = document.getElementById("box");
var oPixel = document.createElement("div");
var oPixelClass = document.createAttribute("class");
oPixelClass.nodeValue = "punkt";
oPixel.setAttributeNode(oPixelClass);
function createCircle()
{
var r = 200;
for(var xVal=0; xVal<=r; xVal++)
{
var yVal = parseInt(Math.sqrt(Math.pow(r,2) - Math.pow(xVal,2)));
for(q=1; q<=4; q++)
{
switch (? ? ? ?)
{
case "1":
x = xVal;
y = r-yVal;
case "2":
x = xVal;
y = r+yVal;
case "3":
x = -xVal;
y = r+yVal;
case "4":
x = -xVal;
y = r-yVal;
var oClonePixel = oPixel.cloneNode(true);
var oClonePixelStyle = document.createAttribute("style");
oClonePixelStyle.nodeValue = "top: "+y+"px; left:"+x+"px;";
oClonePixel.setAttributeNode(oClonePixelStyle);
oBox.appendChild(oClonePixel);
}
}
}
}
createCircle();
</script>
</body>
</html> |