<html>
<head>
<title>Test</title>
<style type="text/css">
<!--
body{font-size:11px;}
a{font-size:1.1em}
h1{font-size:2em}
-->
</style>
<script type="text/javascript">
<!--
/**
* Funktion: get_cookie()
* holt cookie-Wert
* Parameter:cookie-Name
* Rückgabewert: cookie-Wert/ false
**/
function get_cookie( cookieName )
{
strValue = false;
if( strCookie = document.cookie )
{
if( arrCookie = strCookie.match( new RegExp( cookieName + '=([^;]*)', 'g')))
{
strValue=RegExp.$1;
}
}
return(strValue);
}
/**
* Funktion:set_cookie()
* setzt cookie
* Parameter: cookie-Name,cookie-Wert,Haltbarkeit in Tagen
* Rückgabewert: true/false
**/
function set_cookie(cookieName,cookieValue,intDays)
{
if(!is_cookie_enabled())
{
return false;
}
objNow = new Date();
strExp = new Date( objNow.getTime() + ( intDays * 86400000) );
document.cookie = cookieName + '=' +
cookieValue + ';expires=' +
strExp.toGMTString() + ';';
return true;
}
/**
* Funktion:delete_cookie()
* Löscht cookie
* Parameter: cookie-Name
* Rückgabewert: true/false
**/
function delete_cookie(cookieName)
{
if(document.cookie)
{
document.cookie = cookieName + '=' +
get_cookie(cookieName) +
';expires=Thu, 01-Jan-1970 00:00:01 GMT;';
return true;
}
return false;
}
/**
* Funktion is_cookie_enabled()
* prüft ob cookies erlaubt sind
* Parameter: nix
* Rückgabewert: true/false
**/
function is_cookie_enabled()
{
if(typeof navigator.cookieEnabled!='undefined')
{
return navigator.cookieEnabled;
}
set_cookie('testcookie','testwert',1);
if(!document.cookie)
{
return false;
}
delete_cookie('testcookie');
return true;
}
if(is_cookie_enabled())
{
fs=11;
function gfs()
{
if(get_cookie('fs'))
{
fs=get_cookie('fs');
return 'body%7Bfont-size%3A'+fs+'px';
}
return '';
}
function sfs(i)
{
var t=Number(fs)+Number(i);
if(t>8 && t<30)
{
fs=t;
document.getElementsByTagName('body')[0].style.fontSize=fs+'px';
set_cookie('fs',fs,1);
}
}
document.write(unescape('%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A'+gfs()+'%7D%0A%3B%7D%0A%3C%2Fstyle%3E'));
}
//-->
</script>
</head>
<body>
<h1>Schriftgrösse im Dokument ändern</h1>
<a href="javascript:sfs(-1)"><</a> Font-Size <a href="javascript:sfs(1)">></a>
</body>
</html>