Ich hab das ganze noch mal in der Form gemacht:
function xxxxx() {
var xxxx = document.getElementById("xxxx1");
if (xxxx.style.width == "600px") {
xxxx.style.width = "100%";
}
else {
xxxx.style.width = "600px";
}
if (xxxx.style.height == "400px") {
xxxx.style.height = "100%";
}
else {
xxxx.style.height = "400px";
}
if (xxxx.style.top == "50%") {
xxxx.style.top = "0";
}
else {
xxxx.style.top = "50%";
}
if (xxxx.style.left == "50%") {
xxxx.style.left = "0";
}
else {
xxxx.style.left = "50%";
}
if (xxxx.style.margin-left = "-300px") {
xxxx.style.margin-left = "0";
}
else {
xxxx.style.margin-left = "-300px";";
}
if (xxxx.style.margin-top = "-200px") {
xxxx.style.margin-top = "0";
}
else {
xxxx.style.margin-top = "-200px";";
}
}
Und ab margin-left gibts probleme, also alles funktioniert bis auf margin-left und margin-top