Hola Marian !!
Hay que colocarlo en el head !!
Hola, el codigo es muy sencillito, pero ¿donde hay que ponerlo, en el head o en el body?
gracias
<SCRIPT LANGUAGE="JavaScript">
// define variables var month_names = new Array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic");var days_in_month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);var this_date = new Date(); // get todays datevar this_day = this_date.getDate(); // returns date within month - range 1-31var this_month = this_date.getMonth(); // returns month within year - range 0-11
function makeCalendar(the_month, the_year){ first_of_month = new Date(the_year, the_month, 1); // creates instance of date object for first of month day_of_week = first_of_month.getDay(); // returns day within week - range 0-6 if (((the_year % 4 == 0) && (the_year % 100 != 0)) || (the_year % 400 == 0)) { days_in_month[1] = 29; // it's a leap year so change # days in Feb in array } else { days_in_month[1] = 28; // not leap year - future use if multi year calendar built } document.write("<TABLE CALLSPACING=0 CELLPADDING=0>"); // start building the month table document.write("<TR BGCOLOR='maroon'><TH COLSPAN=7>" + month_names[the_month] + " " + the_year); // month and year heading document.write("<TR BGCOLOR='orange'><TH>S</TH><TH>M</TH><TH>T</TH><TH>W</TH><TH>T</TH><TH>F</TH><TH>S</TH></TR>"); // day of week heading document.write("<TR ALIGN=RIGHT>"); var column = 0; for (i=0; i<day_of_week; i++) // skip to day_of_week value for first_of_month { document.write("<TD> </TD>"); column++; } for (i=1; i<=days_in_month[the_month]; i++) { if ((i == this_day) && (the_month == this_month) && (the_year == this_year)) { document.write("<TD BGCOLOR='red'><B>" + i + "</B></TD>"); // highlite todays date } else { document.write("<TD BGCOLOR='black'><B>" + i + "</B></TD>"); // no highlite for other dates } column++; if (column == 7) // start next row of dates for month { document.write("</TR><TR ALIGN=RIGHT>"); column = 0; } } document.write("</TR></TABLE>"); // month complete - close table} function y2K(number) // if year < 2000 javascript gives only 2 digits for year{ return (number < 1000) ? number + 1900 : number; } var this_year = y2K(this_date.getYear());// --> </SCRIPT>
<!-- document.write("<TABLE BORDER='5' bgcolor=orange><TR VALIGN=TOP><TD>");makeCalendar(0, this_year); // we are passing the month and year to build the calendardocument.write("</TD><TD>"); // in JavaScipt the first month is 0makeCalendar(1, this_year);document.write("</TD><TD>");makeCalendar(2, this_year);document.write("</TD><TD>");makeCalendar(3, this_year);document.write("</TD></TR><TR VALIGN=TOP><TD>");makeCalendar(4, this_year);document.write("</TD><TD>");makeCalendar(5, this_year);document.write("</TD><TD>");makeCalendar(6, this_year);document.write("</TD><TD>");makeCalendar(7, this_year);document.write("</TD></TR><TR VALIGN=TOP><TD>");makeCalendar(8, this_year);document.write("</TD><TD>");makeCalendar(9, this_year);document.write("</TD><TD>");makeCalendar(10, this_year);document.write("</TD><TD>");makeCalendar(11, this_year);document.write("</TD></TR></TABLE>");document.close(); // --> </SCRIPT>
Hola Maury !!
Mira respecto al contador de tiempo , cuando abre empieza y cuando la cerras lo termina .
Si queres ponerle un stop ya voy a hacer otro codigo en estos dias ya que estoy cambiando la pagina agregandole codigos y muchas cosas mas .
Fijate d eponer el codigo entre head y body ya que si no no te va a funcionar.
Cualquier consulta hacemela saber y te ayudo.
Walter
holas!!!!!! disculpa me parece muy bien tu contador quiciera saber como haria yo para implantar en un sistema ese codigo pero que me contara el tiempo en q un usuario inicia una secion y que pare cuando el usuario cierra la sesion si me puedes ayudar lo agradeceria....
chao q estes bien.....
<script language="JavaScript"><!-- hide from other browsers
//Pictures to switch inbetween
var Rollpic1 = "img22.jpg";var Rollpic2 = "img23.jpg";var Rollpic3 = "img24.jpg";
//Start at the what pic:var PicNumber=1;//Number of pics:var NumberOfPictures=3;//Time between pics switching in secsvar HowLongBetweenPic=5;
//SwitchPic Functionfunction SwitchPic(counter){
if(counter < HowLongBetweenPic){ counter++; //DEBUG in the status bar at the bottom of the screen window.status="Cambia imagen cada 5 segundos : "+counter+" - Imagen nº: "+PicNumber+" "; //Display pic in what <IMG> tag roll is what I called the image document.roll.src = eval("Rollpic" + PicNumber); //function calls itself CallSwitchPic=window.setTimeout("SwitchPic("+counter+")",500); } else{ //if its not the last picture goto the next picture if(PicNumber < NumberOfPictures){ PicNumber++; SwitchPic(0); } //its the last picture go to the first one else{ PicNumber=1; SwitchPic(0); } }
}// Stop hiding from old browsers --></script>
<SCRIPT LANGUAGE="JavaScript"> <!-- var hour = "0" var min = "00" var sec = "0" function timer(){ if ((min < 10) && (min != "00")){ dismin = "0" + min } else{ dismin = min } dissec = (sec < 10) ? sec = "0" + sec : sec document.timer.counter.value = hour + ":" + dismin + ":" + dissec
if (sec < 59){ sec++ } else{ sec = "0" min++ if (min > 59){ min = "00" hour++ } } window.setTimeout("timer()",1000) } // --> </SCRIPT> </HEAD> <BODY ONLOAD="timer()"> <FORM NAME="timer"> <P><FONT SIZE="-1" FACE="Arial">Llevas en esta página</FONT> <INPUT TYPE="TEXT" NAME="counter"></P> </FORM> <BR> <P><FONT SIZE="-1" FACE="Arial"><B></B></FONT></P>