<script type="text/javascript">
<!--
var MyObject;
var xstart=450,ystart=200,xabs,yabs;
function SetAbsPos(x,y) /* setzen der absoluten Koordinaten */
{
xabs=x;
yabs=y;
MyObject.width=xabs;
MyObject.height=yabs;
}
function SetRelPos(x,y) /* relative Verschiebung des Objekts */
{
xabs+=x;
yabs+=y;
/* Sicherung, dass Koordinaten in Grenzen bleiben: */
if (xabs<0)
xabs=0;
if (xabs>1024)
xabs=1024;
if (yabs<0)
yabs=0;
if (yabs>1024)
yabs=1024;
/* setzen der Position */
MyObject.width=xabs;
MyObject.height=yabs;
speichere_cookie();
}
function Init() {
var cookiewidth = GetCookie('width');
var cookieheight = GetCookie('height');
if (document.all) { /* Fuer Konqueror, Opera und Internet Explorer */
MyObject=document.all.MyDiv.style;
} else {
if (typeof(document.getElementById)=="function") {/* Fuer Netscape Navigator 6.x */
MyObject=document.getElementById("MyDiv").style;
} else {
if (document.MyDiv) {/* Fuer Netscape Navigator 4.x */
MyObject=document.MyDiv;
} else { /* Fuer dumme Browser, die von nichts wissen wollen */
alert("Your stupid browser is not really able to support the functionality of this page");
}
}
}
//Wenn Ich anstatt der If Abfrage nur das hier reinmache:
//SetAbsPos(xstart,ystart);
//funktioniert es
//Mit Abfrage nicht :(
//Und mit dem hier:
//SetAbsPos(cookiewidth,cookieheight);
//Auch nicht
if ( cookiewidth == null ) {
SetAbsPos(xstart,ystart);
} else {
SetAbsPos(cookiewidth,cookieheight);
}
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function speichere_cookie () {
SetCookie('width', document.getElementById("MyDiv").style.width);
SetCookie('height', document.getElementById("MyDiv").style.height);
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
//-->
</script>