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>

Fechas y horarios