Код:
<script type="text/javascript"> function getarr() {var x=0 var arr=new array(0) var arr1=document.getelementsbytagname("table") for (x in arr1) {while (x<=5) { if (arr1[x].rows[0].cells.length==4) {var z=arr1[x].rows var j=0 for (j=0; j<=(z.length-1); j++) {arr.splice(0, 0, z[j].cells[3].innerhtml) }} x=x+1}} return arr} var d=new date() var c=d.getmonth()+1 var a=d.getdate() var today=c+"."+a var g=new date() var ops=d.gettime()-(24*60*60*1000) g.settime(ops) var yes=(g.getmonth()+1)+"."+g.getdate() function getit() { var brr=getarr() var i=0 var crr=new array(0) for (i in brr) {if ((i<=(brr.length -1))&&(brr[i].indexof(" - ") != -1)) {if (brr[i].substr(brr[i].indexof(" - ")-14, 5)=="годня") {crr.splice (0, 0, today)} else if (brr[i].substr(brr[i].indexof(" - ")-14, 3)=="вче") {crr.splice (0, 0, yes)} else { crr.splice (0, 0, brr[i].substr(brr[i].indexof(" - ")-14, 2)+"."+brr[i].substr(brr[i].indexof(" - ")-11, 2))} i=i+1}} return crr} var now=getit() function sortnumber(a, b) { return a - b } var ok=now.sort(sortnumber) var wait=ok.pop() var h=new date() h.setutcfullyear (2006, wait.substring (0, wait.indexof(".")) -1, wait.substr (wait.indexof(".")+1)) var hih=math.round((d.gettime()-h.gettime())/(24*60*60*1000)) function countit() { alert(20-hih)} </script> <input type="button" value="сlosed forum" onclick="countit()" />