PDA

Zobacz pełną wersję : Problem z licznikiem czasu do danej daty



seboo107
23-01-2011, 11:51
Witam!!

wczoraj wieczorem znalazłem skrypcik, przerobiłem go i wstawiłem na joomle po przez edycję kodu html szablonu. Wszystko fajnie się wstawiło, w to miejsce w które chcialem, tylko wyszło mi trochę za "wysokie" >>> www.ssszorly.pl >> umieszczone na logu

Próbowałem zmieniać rozmiar w kodzie, tak jak to wcześniej robiłem przy edycji tego zegarka, ale nic się nie zmienia....

Wstawiam wam kod

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<title>Nowa strona 1</title>

<!-- head sekundy -->
<script type="text/javascript">

/***********************************************
* Dynamic Countdown script- Š Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function cdtime(container, targetdate){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
this.currentTime=new Date()
this.targetdate=new Date(targetdate)
this.timesup=false
this.updateTime()
}

cdtime.prototype.updateTime=function(){
var thisobj=this
this.currentTime.setSeconds(this.currentTime.getSe conds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

cdtime.prototype.displaycountdown=function(baseuni t, functionref){
this.baseunit=baseunit
this.formatresults=functionref
this.showresults()
}

cdtime.prototype.showresults=function(){
var thisobj=this


var timediff=(this.targetdate-this.currentTime)/1000 //difference btw target date and current date, in seconds
if (timediff<0){ //if time is up
this.timesup=true
this.container.innerHTML=this.formatresults()
return
}
var oneMinute=60 //minute unit in seconds
var oneHour=60*60 //hour unit in seconds
var oneDay=60*60*24 //day unit in seconds
var dayfield=Math.floor(timediff/oneDay)
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
hourfield=dayfield*24+hourfield
dayfield="n/a"
}
else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
minutefield=dayfield*24*60+hourfield*60+minutefiel d
dayfield=hourfield="n/a"
}
else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
var secondfield=timediff
dayfield=hourfield=minutefield="n/a"
}
this.container.innerHTML=this.formatresults(dayfie ld, hourfield, minutefield, secondfield)
setTimeout(function(){thisobj.showresults()}, 1000) //update results every second
}

/////CUSTOM FORMAT OUTPUT FUNCTIONS BELOW//////////////////////////////

//Create your own custom format function to pass into cdtime.displaycountdown()
//Use arguments[0] to access "Days" left
//Use arguments[1] to access "Hours" left
//Use arguments[2] to access "Minutes" left
//Use arguments[3] to access "Seconds" left

//The values of these arguments may change depending on the "baseunit" parameter of cdtime.displaycountdown()
//For example, if "baseunit" is set to "hours", arguments[0] becomes meaningless and contains "n/a"
//For example, if "baseunit" is set to "minutes", arguments[0] and arguments[1] become meaningless etc


function formatresults(){
if (this.timesup==false){//if target date/time not yet met
var displaystring="<p style=\"font-size: 10px; font-family: tahoma; color: #000000;\">Za "+arguments[0]+" dni "+arguments[1]+" godzin "+arguments[2]+" minut "+arguments[3]+" sekund mecz Orzeł Łódź vs ROW Rybnik"
}
else{ //else if target date/time met
var displaystring="<p style=\"font-size: 10px; font-family: tahoma; color: #000000;\">było: mecz Orzeł Łódź vs ROW Rybnik"
}
return displaystring
}

function formatresults2(){
if (this.timesup==false){ //if target date/time not yet met
var displaystring="<p style=\"font-size: 10px; font-family: tahoma; color: #000000;\">Za "+arguments[0]+" dni "+arguments[1]+" godzin "+arguments[2]+" minut "+arguments[3]+" sekund mecz Orzeł Łódź vs ROW Rybnik"
}
else{ //else if target date/time met
var displaystring="<p style=\"font-size: 10px; font-family: tahoma; color: #000000;\">mecz Orzeł Łódź vs ROW Rybnik" //Don't display any text
}
return displaystring
}

</script>
<!-- /head -->
</head>

<body>

<center>
<!--start kodu-->
<table border="1" cellspacing="1" style="border-collapse: collapse; font-family: Verdana; font-size: 10 px; bordercolor: #000000; width: 250; height: 150;" bgcolor="transparent">
<tr><td align="center" style="background-image:url()">

<div style="position: relative; top: 2; left:0;">
<img src="http://img88.imageshack.us/img88/6479/logoyq.png" border="0" alt="ile czasu do..."/></a>
<div id="countdowncontainer"></div>
<script type="text/javascript">

var futuredate=new cdtime("countdowncontainer", "4 3, 2011 00:00:00")
futuredate.displaycountdown("days", formatresults)

var currentyear=new Date().getFullYear()
//dynamically get this Christmas' year value. If Christmas already passed, then year=current year+1
var thischristmasyear=(new Date().getMonth()>=11 && new Date().getDate()>25)? currentyear+1 : currentyear
var christmas=new cdtime("countdowncontainer2", "December 25, "+thischristmasyear+" 0:0:00")
christmas.displaycountdown("days", formatresults2)
</script>
<noscript><a href="http://dodatki.blogowicz.info/wlepki,dla,webmastera/darmowe,komponenty/licznik,ile,czasu,do/">ile czasu po</a>
<a href="http://dodatki.blogowicz.info/">kalendarze</a></noscript>
</div></td></tr></table>
<!--/koniec kodu-->
</center>
</body>

Wysokość zmieniam w tym kodzie:
<table border="1" cellspacing="1" style="border-collapse: collapse; font-family: Verdana; font-size: 10 px; bordercolor: #000000; width: 250; height: 150;" bgcolor="transparent">

Ale nic mi się nie zmienia...

Dodam że logo strony zostanie zmienione pod ten dodatek ;)

Z góry ThX za pomoc

Bazyl
23-01-2011, 12:08
Cześć,

Daj górny margines dla div id="countdowncontainer"

Robster
23-01-2011, 12:08
A grafikę próbowałeś zmniejszyć? Jak chcesz tabelę zmniejszyć jak masz grafikę o stałym rozmiarze? Sama zmiana wysokości tabeli nie zrobi resize obrazka, co najwyżej pojawi się scroll jeśli taki w css włączysz. Zmniejsz grafikę i napisz co wyszło.

seboo107
23-01-2011, 12:29
Wolał bym grafikę zostawić w takim rozmiarze w jakim jest ;) ale zaraz sprawdzę ze zmniejszoną grafiką


Edit: Pomogło :D Wystarczyło usunąć trochę przeźroczystego tła ;) Wielkie dzięki. Punkcik reputacji poleciał :)

Bazyl
23-01-2011, 13:04
Ja Cię zrozumiałem inaczej...
Teraz licznik zlewa się z tłem.
Pisałem o marginesie, by opuścić go na niebieski pasek pod obrazkami. :)

seboo107
23-01-2011, 13:18
Pisałem już w pierwszym poście że logo strony zostanie zmienione pod ten dodatek ;)

Bazyl
23-01-2011, 13:21
Znaczy, jak zawsze: diabeł tkwi w szczegółach...
@Robster ma młodsze oczy :)

Robster
23-01-2011, 13:32
Hej @bazyl. Z tymi oczami/oczyma* to różnie bywa :) Najczęściej to ja czytam jakieś pierdoły ^^

Dzięki @seboo107 za reputkę, ostatnio mało osób o niej pamięta, nawet o zwykłe dziękuje trudno :)


*nieprawidłowe skreślić