Ho trovato su flash-mx.html.it il codice e i file per realizzare quello che potete vedere a questo link
http://flash-mx.html.it/articoli/img...tml/pagina.htm
il tutto usa i cookie e purtroppo non sono molto pratico, mi date una conferma?
function Browser() {
this.n4 = (document.layers) ? 1 : 0;
this.ie = (document.all) ? 1 : 0;
this.n6 = (document.getElementById) ? 1 : 0;
}
function centra(id,left) {
if (bw.n4){
this.obj = document.layers[id];
}else if(bw.ie){
this.obj = document.all[id].style;
}else if(bw.n6){
this.obj = document.getElementById(id).style;
}
this.obj.left = (left>50) ? left : 50;
this.obj.top = 15;
return this.obj;
}
function setup(prima){
bw = new Browser();
if(bw.ie) {
wdth = Math.round(document.body.clientWidth);
}else if(bw.n4 || bw.n6){
wdth = Math.round(window.innerWidth);
}
if(prima){
lay = new centra('logo', Math.round((wdth/2)-350));
DisplayInfo();
scrivi()
}else{
if(bw.n4){
location.reload();
}else if(bw.ie || bw.n6){
lay = new centra('logo', Math.round((wdth/2)-350));
}
}
}
function scrivi() {
var net = "";
var exp = "<OBJECT classid='clsid27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH='700' HEIGHT='400'><PARAM NAME=movie VALUE='/movie.swf'><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><PARAM NAME=bgcolor VALUE=#CCCCCC><EMBED src='/movie.swf' quality=high wmode=transparent bgcolor=#CCCCCC WIDTH='700' HEIGHT='400' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></OBJECT>"
if (bw.n4) {
document.layers.logo.document.close();
document.layers.logo.document.write(net);
document.layers.logo.document.close();
}else if(bw.ie){
if(document.readyState == "complete"){
if(visitato || navigator.cookieEnabled == false){
eval("document.all.logo.innerHTML = net");
}else{
eval("document.all.logo.innerHTML = exp");
}
}else{
timerID = setTimeout("scrivi()",100);
}
}else if(bw.n6){
document.getElementById("logo").innerHTML = net;
}
}
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 SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
// expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
expdate.setTime(expdate.getTime() + (10 * 1000));
if(!(visit = GetCookie("dhtmlFlash"))) visit = 0;
visit++;
SetCookie("dhtmlFlash", visit, expdate, "/", null, false);
if(visit > 1){
visitato = true;
}else{
visitato = false;
}
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("dhtmlFlash", visit, expdate , "/", null, false);
leapto();
}
Per dare una durata al cookie di 3 ore devo modificare la riga che ho postato in grassetto? se si come? (nell'esempio dice che questo cookie dura 10sec, se la riga è quella è 10*1000, quindi per 3 ore dovrei fare 10800*1000).Confermate oppure ne ho capito ancora meno di quanto credo???![]()
TNX e BUON NATALE![]()