Ejemplos en Javascript
Última Modificación con variante
La variante respecto al ejemplo ya examinado en estas páginas es que el script informa también de si la página de la última visita ha sido modificada.
<HTML>
<HEAD>
<TITLE>Ejemplos Javascript: ejemplo prÃ?Æ?Ã?¡ctico </TITLE>
</HEAD>
<BODY bgcolor="white">
<script language="JavaScript">
<!----- Script CopyRight Ã?â??Ã?© 1996 - 1997 S.Chris Brown (Spikeman) http://www.geocities.com/BourbonStreet/3843
/*******************************************************
** S.Christopher Brown's (Spikeman)'s **
** java script Cookie (lastModified ) **
** CopyRight Ã?â??Ã?© 1996 - 1997 S.Chris Brown (Spikeman) **
** http://www.geocities.com/BourbonStreet/3843 **
** All Rights Reserved **
** You can freely use this script, if this credit is **
** given in the source. So that mean don't mess around **
** with my ( Spikeman ) Script or Script's k ? **
** Thank you **
*******************************************************/
// This JavaScript code Modifications by S.Chris Brown (Spikeman) 1996 - 1997 ( http://www.geocities.com/BourbonStreet/3843 )
<!-- hide from non-JavaScript browsers
function getCookieVal (offset) {
var endstr = document.cookie.indexOf ("Spikeman_Cookie", 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("Spikeman_Cookie", i) + 1;
if (i == 0) break;
}
return null;
}
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" : "");
}
function DeleteCookie(name) {
var exp = new Date();
FixCookieDate (exp); // Correct for Mac bug
exp.setTime (exp.getTime() - 1); // This cookie is history
var cval = GetCookie (name);
if (cval != null)
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var cookie_date=new Date(document.lastModified);
var expdate = new Date();
expdate.setTime(expdate.getTime()+(1*5*18*33*1000));
document.write("This page last updated on:<P> "+document.lastModified);
document.write("<br>");
if (!(cookie_date == GetCookie("cookie_date"))){
SetCookie("cookie_date",cookie_date,expdate);
document.write("<font color='Red'>This page has changed since your last visit!</font><br>");
}
// end hide -->
</script>
</body>
</html>
<HEAD>
<TITLE>Ejemplos Javascript: ejemplo prÃ?Æ?Ã?¡ctico </TITLE>
</HEAD>
<BODY bgcolor="white">
<script language="JavaScript">
<!----- Script CopyRight Ã?â??Ã?© 1996 - 1997 S.Chris Brown (Spikeman) http://www.geocities.com/BourbonStreet/3843
/*******************************************************
** S.Christopher Brown's (Spikeman)'s **
** java script Cookie (lastModified ) **
** CopyRight Ã?â??Ã?© 1996 - 1997 S.Chris Brown (Spikeman) **
** http://www.geocities.com/BourbonStreet/3843 **
** All Rights Reserved **
** You can freely use this script, if this credit is **
** given in the source. So that mean don't mess around **
** with my ( Spikeman ) Script or Script's k ? **
** Thank you **
*******************************************************/
// This JavaScript code Modifications by S.Chris Brown (Spikeman) 1996 - 1997 ( http://www.geocities.com/BourbonStreet/3843 )
<!-- hide from non-JavaScript browsers
function getCookieVal (offset) {
var endstr = document.cookie.indexOf ("Spikeman_Cookie", 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("Spikeman_Cookie", i) + 1;
if (i == 0) break;
}
return null;
}
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" : "");
}
function DeleteCookie(name) {
var exp = new Date();
FixCookieDate (exp); // Correct for Mac bug
exp.setTime (exp.getTime() - 1); // This cookie is history
var cval = GetCookie (name);
if (cval != null)
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var cookie_date=new Date(document.lastModified);
var expdate = new Date();
expdate.setTime(expdate.getTime()+(1*5*18*33*1000));
document.write("This page last updated on:<P> "+document.lastModified);
document.write("<br>");
if (!(cookie_date == GetCookie("cookie_date"))){
SetCookie("cookie_date",cookie_date,expdate);
document.write("<font color='Red'>This page has changed since your last visit!</font><br>");
}
// end hide -->
</script>
</body>
</html>
Fechas y horarios
- Fecha última modificación
- Qué hora es 1/2
- Qué hora es 2/2
- Fecha, hora y días transcurridos desde el inicio del año
- Día, hora y fecha pero sólo si se piden
- Horario en la barra de estado del navegador
- Fecha y hora en la barra de estado con botones
- El día de la semana en que naciste
- Tu edad en días, horas, minutos y segundos
- Tiempo y coste de conexión con una página
- Husos horarios del mundo
- Tiempo de acceso a una página
- Horario y tiempo pasado en una página con un botón
- Fecha y hora
- Husos horarios: primer ejemplo
- Saludos, fecha, horario y calendario del mes
- Calendario completo
- Agenda
- Fecha y hora en un alert activado por boton
- Contador con término final
- Cuenta atrás con término final
- Fecha y hora de entrada en una página web
- Husos horarios, secondo esempio
- Tiempo que falta para una cierta fecha
- Última Modificación con variante
- Mensaje según el día de la semana
- Fecha última visita con cookie
- Husos horarios: tercer ejemplo
- Calendario con formulario
- Signos zodiacales
- Recordatorio
- Husos horarios: cuarto ejemplo
- Otro calendario
- Día de la semana a partir de una fecha