17 diciembre 2008

Otra forma de colocar la fecha.

Si deseas colocar la fecha en tu blog como aparece en el tope de la sidebar de éste blog, sólo tienes que copiar y pegar el código a continuación.

<script language="JavaScript">
<!--
// ==============================================
// Copyright 2003 by jsCode.com
// Source: jsCode.com
// Author: etLux
// Free for all; but please leave in the header.
// ==============================================

// Set the font color, face, size, and style...

// Acceptable TheFontFace values are those you
// normally use in HTML, for instance:
// Arial
// TimesRoman
// Courier

// Acceptable TheFontColor values are any #RRGGBB
// same as HTML. Remember to use the # sign and
// enclose in quotes. Typical values:
// #FF0000 is red
// #00FF00 is green
// #0000FF is blue

// Acceptable TheFontSize values are 2-7.

// Acceptable TheFontStyle values are (exactly!):
// plain
// bold
// italic
// bolditalic

var TheFontFace = "Arial";
var TheFontColor = "#FF0000";
var TheFontSize = "3";
var TheFontStyle = "bolditalic";

// Set the separator between the date elements;
// usually use either - or /.

var TheSeparator = "-";

// Show or do not show the day of the week; set
// yes to show, no not to show.

var ShowDay ="yes";

// Do Not Edit Below This Line
// ==============================================

var Days = new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
var TheDate = new Date();

var TheWeekDay = TheDate.getDay();
var Day ="";
if (ShowDay == "yes"){
Day = Days[TheWeekDay];
Day += " ";}

var TheMonthDay = TheDate.getDate();
if (TheMonthDay < 10) TheMonthDay = "0" + TheMonthDay;

var TheMonth = TheDate.getMonth() + 1;
if (TheMonth < 10) TheMonth = "0" + TheMonth;

var TheYear = TheDate.getYear();
if (TheYear < 1000) TheYear += 1900;

var FontTagLeft = "";
var FontTagRight = "";

if (TheFontStyle == "bold"){
FontTagLeft = "<b>";
FontTagRight ="</b>";}

if (TheFontStyle == "italic"){
FontTagLeft = "<i>";
FontTagRight ="</i>";}

if (TheFontStyle == "bolditalic"){
FontTagLeft = "<b><i>";
FontTagRight = "</i></b>";}

var D = "";
D += "<font color='"+TheFontColor+"' face='"+TheFontFace+"' size='"+TheFontSize+"'>";
D += FontTagLeft+Day+TheMonthDay+TheSeparator+TheMonth+TheSeparator+TheYear+FontTagRight;
D += "</font>";

document.write(D);

//-->
</script>


NOTA: He modificado el código, ya que en el idioma ingles el día aparece en ese idioma, lo referente a la fecha primero colocan el mes, luego la fecha y por último el año. Con el código copiado tal y cual está les aparecerá la fecha de la misma forma que está en el tope de la sidebar.


0 comentarios:

Publicar un comentario

Tu comentario ser� moderado la primera vez que lo hagas al igual que si incluyes enlaces. A partir de ahi no ser necesario si usas los mismos datos y mantienes la cordura. No se publicar�n insultos, difamaciones o faltas de respeto hacia los lectores y comentaristas de este blog.