PHP beginner |
|
de javascript variabelle in een cookie zetten en de pagina reloaden
<?
if(!isset($_COOKIE['prefs'])) {
?>
<script language="JavaScript">
createCookie('prefs', screen.width + '.' + screen.height)
function createCookie(name,value)
{
var date = new Date();
date.setTime(date.getTime()+(1*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = name+"="+value+expires+"; path=/";
}
</script>
<?
} else {
$res = explode(".", $_COOKIE['prefs']);
//width
$res[0];
//height
$res[1];
}
?>
<? if(!isset($_COOKIE['prefs'])) { ?> <script language="JavaScript"> createCookie('prefs', screen.width + '.' + screen.height) function createCookie(name,value) { var date = new Date(); date.setTime(date.getTime()+(1*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = name+"="+value+expires+"; path=/"; } </script> <? } else { $res = explode(".", $_COOKIE['prefs']); //width $res[0]; //height $res[1]; } ?>
|