Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/09/2012, 16:09
kingflower
 
Fecha de Ingreso: mayo-2009
Mensajes: 31
Antigüedad: 14 años, 11 meses
Puntos: 1
Busqueda Como Asociar Imagen Script Java

Hola un saludo, quisiera que alguien me ayude con lo siguente, por ahi buscando en la web un codigo de hecho es un script Java para un calendario, encontre uno que muestra la fecha con el dia, hora y un evento para ese dia, a continuacion les pongo el codigo:

<script language="Javascript1.2">

var tags_before_clock = "<big>"
var tags_after_clock = "<\/big>"

if(navigator.appName == "Netscape") {
document.write('<layer id="clock"><\/layer><br>');
}

if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<span id="clock"><\/span><br>');
}

function upclock(){
var dte = new Date();
var hrs = dte.getHours();
var min = dte.getMinutes();
var sec = dte.getSeconds();
var col = ":";
var spc = " ";
var apm;

if (12 < hrs) {
apm="PM";
hrs-=12;
}

else {
apm="AM";
}

if (hrs == 0) hrs=12;
if (min<=9) min="0"+min;
if (sec<=9) sec="0"+sec;

if(navigator.appName == "Netscape") {
document.clock.document.write(tags_before_clock
+hrs+col+min+col+sec+spc+apm+tags_after_clock);
document.clock.document.close();
}

if (navigator.appVersion.indexOf("MSIE") != -1){
clock.innerHTML = tags_before_clock+hrs
+col+min+col+sec+spc+apm+tags_after_clock;
}
}

setInterval("upclock()",1000);
//-->
</SCRIPT>

<SCRIPT type=text/Javascript>
<!--
/*
Java Script Calendar
*/

calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year < 1000)
year+=1900
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;
var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname =
new Array ("January","February","March","April","May","June" ,"July","August","September","October","November", "December" );
document.write("<font face=verdana,arial size=2>");
document.write(dayname[day] + ", ");
document.write(monthname[month] + " ");
if (date< 10) document.write("0" + date + ", ");
else document.write(date + ", ");
document.write(year + " <BR><font color=FF0000>");
// Easter
if ((month == emonth) && (date == edate)) document.write("Easter Sunday (Western) ");
// January
if ((month == 0) && (date == 1)) document.write("New Year's Day");
// February
if((month == 1) && (date == 14)) document.write("St. Valentine's Day");
// March
if ((month == 2) && (date == 17)) document.write("St. Patrick's Day");
// April
if ((month == 3) && (date == 22)) document.write("Earth Day");
// May
if ((month == 4) && (date == 5)) document.write("Cinco de Mayo (Mexico), Children's Day (Japan)");
// June
if ((month == 5) && (date == 21)) document.write("Summer Solstice");
// July
if ((month == 6) && (date == 4)) document.write("Independence Day (USA)");
// August
if ((month == 7) && (date == 15)) document.write("Independence Day (India)");
// September
if ((month == 8) && (date == 7)) document.write("Independence Day (Brazil)");
if ((month == 8) && (date == 16)) document.write("Independence Day (Mexico)");
// October
if ((month == 9) && (date == 24)) document.write("United Nations Day");
if ((month == 9) && (date == 31)) document.write("Halloween");
// November
if ((month == 10) && (date == 1)) document.write("All Saints Day");
if ((month == 10) && (date == 2)) document.write("All Souls Day");
if ((month == 10) && (date ==20)) document.write("Revolution Day (Mexico)");
if ((month == 10) && (day == 4) && (date > 23) && (date< 30)) document.write("Thanksgiving (USA)");
// December
if ((month == 11) && (date == 25)) document.write("Christmas");
document.write("<br><\/font>");
//-->
</SCRIPT>

<SCRIPT type=text/javaScript>

<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);
// End -->
</SCRIPT>

lo que hace es mostrar la fecha de la siguiente manera por ejemplo:

---------------------------------------
Saturday, September 22, 2012

Good Afternoon!
---------------------------------------

Bien pero el script dependiendo el dia tambien asocia un evento a la fecha por ejemplo el dia 24 de octubre "United Nations Day" o el 31 de octubre "halloween", entro otros.

Bien lo que quiero hacer pero no se como que lineas de codigo tendria que agregar para que por ejemplo el dia 24 de octubre que el el dia de las naciones unidas no solo me muestre la fecha sino ademas una imagen relacionada con dicho evento, es decir que le pongo a la siguiente para hacer lo que les menciono

---------------------------------------------------------------------------------------------
if ((month == 9) && (date == 24)) document.write("United Nations Day");
---------------------------------------------------------------------------------------------


es posible hacer eso? o se tendria que modificar otras partes del script.


Bien espero haber sido claro y entendible ojala y se pueda y me puedan ayudar diciendome como se hace.

Un saludo y Gracias....