DeltiX
Administrator
Dołączył: 20 Kwi 2006
Posty: 219
Przeczytał: 0 tematów
Pomógł: 2 razy Ostrzeżeń: 0/5
|
Wysłany: Czw 0:02, 23 Lip 2009 Temat postu: Kalkulator transferu |
|
|
[link widoczny dla zalogowanych]
Opis: Skrypt, który pokazuje nam informację ile będzie trwało ściąganie pliku w zależności od jego wielkości i szybkości naszego połączenia internetowego.
Kod: | <SCRIPT language=JavaScript>
function MakeArray(n) {
this.length = n;
for (var i = 1; i <= n; i++) {
this[i] = 0 }
return this
}
speedVar = new MakeArray(11);
speedVar[1] = "1.1719"
speedVar[2] = "1.7578"
speedVar[3] = "3.5156"
speedVar[4] = "6.8359"
speedVar[5] = "7.8125"
speedVar[6] = "16.6250"
speedVar[7] = "187.9883"
speedVar[8] = "1220.7031"
speedVar[9] = "3295.8984"
speedVar[10] = "5493.1641"
speedVar[11] = "18920.8984"
function compute(form, mult){
for (i=1; i < 12; i++){
if (form.size.value==null||form.size.value.length==0){
form.size.value=0;}
if (form[i+"hour"].value==null||form[i+"hour"].value.length==0){
form[i+"hour"].value=0;}
if (form[i+"minute"].value==null||form[i+"minute"].value.length==0){
form[i+"minute"].value=0;}
if (form[i+"second"].value==null||form[i+"second"].value.length==0){
form[i+"second"].value=0;}
if (mult != 0 && form.size.value != 0){
with (Math){
var speed = speedVar[i];
var TotalTime = ((form.size.value*mult)/speed);
var TotalHours = floor((TotalTime/3600));
var TotalHoursMod = (TotalTime%3600);
var TotalMin = floor(TotalHoursMod/60);
var TotalMinMod = (TotalHoursMod%60);
var TotalSec = floor(TotalMinMod);
form[i+"hour"].value=TotalHours;
form[i+"minute"].value=TotalMin;
form[i+"second"].value=TotalSec;
}}}
return;
}
function newscreen() {
javadisplay = window.open("calculator.html","javadisplay","width=470,height=320,history=yes,status=no,toolbar=no,scrollbars=no,")
}
</SCRIPT>
<FORM method=post><INPUT type=hidden size=6 name=7second><INPUT type=hidden
size=6 name=7minute><INPUT type=hidden size=6 name=7hour>
<TABLE align="center" border=0 class="tx">
<TBODY>
<TR>
<TD><INPUT class=pole1 name="size" value="wpisz rozmiar pliku"
size="12" style="width:120px;" onFocus="if(this.value=='wpisz rozmiar pliku')this.value=''" onBlur="if(this.value=='')this.value='wpisz rozmiar pliku'"> <INPUT class=button1 onclick="compute(this.form, 1)" type=button value="Kb"> <INPUT class=button1 onclick="compute(this.form, 1024)" type=button value="Mb"></TD>
<TD colSpan=3>
<CENTER><P>Czas ściągania.
:</P></CENTER></TD></TR>
<TR>
<TH>
<P align=left><small>Prędkość połączenia
:</small></P></TH>
<TH><p><small>Godziny</SMALL></p</TH>
<TH><p><small>Minuty</SMALL></p></TH>
<TH><p><small>Sekundy</SMALL></p></TH></TR>
<TR>
<TD ?>9.6 Kb</TD>
<TD><INPUT class="pole1" size=6 name=1hour></TD>
<TD><INPUT class="pole1" size=6 name=1minute></TD>
<TD><INPUT class="pole1" size=6 name=1second></TD></TR>
<TR>
<TD ?>14.4 Kb</TD>
<TD><INPUT class="pole1" size=6 name=2hour></TD>
<TD><INPUT class="pole1" size=6 name=2minute></TD>
<TD><INPUT class="pole1" size=6 name=2second></TD></TR>
<TR>
<TD ?>28.8 Kb</TD>
<TD><INPUT class="pole1" size=6 name=3hour></TD>
<TD><INPUT class="pole1" size=6 name=3minute></TD>
<TD><INPUT class="pole1" size=6 name=3second></TD></TR>
<TR>
<TD ?>56 Kb</TD>
<TD><INPUT class="pole1" size=6 name=4hour></TD>
<TD><INPUT class="pole1" size=6 name=4minute></TD>
<TD><INPUT class="pole1" size=6 name=4second></TD></TR>
<TR>
<TD ?>ISDN (64 Kb)</TD>
<TD><INPUT class="pole1" size=6 name=5hour></TD>
<TD><INPUT class="pole1" size=6 name=5minute></TD>
<TD><INPUT class="pole1" size=6 name=5second></TD></TR>
<TR>
<TD ?>ISDN (128 Kb)</TD>
<TD><INPUT class="pole1" size=6 name=6hour></TD>
<TD><INPUT class="pole1" size=6 name=6minute></TD>
<TD><INPUT class="pole1" size=6
name=6second></TD></TR><INPUT type=hidden size=6 name=8hour> <INPUT
type=hidden size=6 name=8minute> <INPUT type=hidden size=6 name=8second>
<INPUT type=hidden size=6 name=9hour> <INPUT type=hidden size=6 name=9minute>
<INPUT type=hidden size=6 name=9second> <INPUT type=hidden size=6 name=10hour>
<INPUT type=hidden size=6 name=10minute> <INPUT type=hidden size=6
name=10second> <INPUT type=hidden size=6 name=11hour> <INPUT type=hidden
size=6 name=11minute> <INPUT type=hidden size=6 name=11second>
</TBODY></TABLE></FORM> |
Post został pochwalony 0 razy
|
|