casdev@canada.com (- - Pierre) wrote[color=blue]
> warning them that this attachment size would take "x" amount of time
> based on a speed of 24 kilobits per second (kbps). my users will be coming "thru" a satellite
> connection and I wish to give them an idea of the time it would take
> prior to clicking "save and close" and using this very expensive
> connection.[/color]
Not tested throughout, but this should provide some basic functionality:
<input type=text onchange="ask(this)">
<script>
function ask(el){
size=el.value.toLowerCase();
sizeno=el.value.replace(/\D/g,'');
if(size.indexOf('kb')+1){sizeno=sizeno*1024;}
if(size.indexOf('mb')+1){sizeno=sizeno*1024*1024;}
seconds=Math.round(sizeno*8/24/1000);
msg='At 24kbps, ' + size + ' would take '
+ minsec(seconds)
+ '.\nWould you like to continue?';
if(confirm(msg))
{}//they accept
else
{el.value='';el.focus();}
}
function minsec(s){
m=Math.floor(s/60);
s-=60*m;
if(m)m+=' minutes and ';
return m+s+' seconds';
}
</script>
HTH
Ivo
[color=blue]
> Ciao,
>
> --Pierre
>[/color]