Cat am trit script java - Forum

[ Mesaje noi · Membrii · Regulamentul forumului · Căutare · RSS ]
Pagina 1 din 11
Forum » Tutoriale si Resurse (T&R) » T&R Java » Cat am trit script java
Cat am trit script java
GravediggerData: Joi, 2012-12-27, 5:22 AM | Mesaj # 1
Gravedigger
Administrator
Grup: Administratori
Mesaje: 542
Premii: 10
Reputatie: 5
Stare: Offline
Acest script va ajuta sa calculati cate zile ati trait.

In sectiunea HEAD adaugati:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
function lifetimer(){             

         today = new Date()           

         BirthDay = new Date(document.live.age.value)          

         timeold = (today.getTime() - BirthDay.getTime());          

         sectimeold = timeold / 1000;          

         secondsold = Math.floor(sectimeold);          

         msPerDay = 24 * 60 * 60 * 1000 ;          

         timeold = (today.getTime() - BirthDay.getTime());          

         e_daysold = timeold / msPerDay;          

         daysold = Math.floor(e_daysold);          

         e_hrsold = (e_daysold - daysold)*24;          

         hrsold = Math.floor(e_hrsold);          

         minsold = Math.floor((e_hrsold - hrsold)*60);            

         document.live.time1.value = daysold               

         document.live.time2.value = hrsold                

         document.live.time3.value = minsold               

         window.status = "Well at the moment you are " + secondsold + "............ seconds old.";          

         timerID = setTimeout("lifetimer()",1000)    

}         
// -- done hiding from old browsers -->

</script>


Iar urmatorul cod dupa tagul BODY:
<FORM name="live">

Please enter your age::<INPUT TYPE="text" NAME="age" VALUE="" SIZE=20>  
Example: (november 1,1966) <BR><BR><BR>
<INPUT TYPE="button" NAME="start" VALUE="Start Timer" ONCLICK="lifetimer(this.form)">

<INPUT TYPE="reset" NAME="resetb" VALUE="Reset Age">

<BR><BR>

<TABLE border=0>
<TR><TD>You are days old:</TD>

<TD>

<INPUT TYPE="text" NAME="time1" VALUE="" size=8>

</TD>

</TR>

<TR><TD>Plus hours old:</TD>

<TD>

<INPUT TYPE="text" NAME="time2" VALUE="" size=8>

</TD>

</TR>

<TR><TD>Plus minutes old:</TD>

<TD><INPUT TYPE="text" NAME="time3" VALUE="" size=8></TD>

</TR>
</TABLE>
</FORM>
 
Forum » Tutoriale si Resurse (T&R) » T&R Java » Cat am trit script java
Pagina 1 din 11
Căutare: