123123123
Erfahrenes Mitglied
Hallo am so einem schönen Datum
!
Welche Variable oder Ausdruck soll ich bei switch (? ? ? ?) schreiben, damit es ausgegeben wird? Hab echt alles versucht!
Mercii!

Welche Variable oder Ausdruck soll ich bei switch (? ? ? ?) schreiben, damit es ausgegeben wird? Hab echt alles versucht!
Code:
<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>
Mercii!
