Sat na forumu

Pogledaj prethodnu temu Pogledaj sledeću temu Ići dole

Sat na forumu

Počalji od Mr.Joker taj Sub Jan 07, 2012 11:32 pm

Ovaj kod sam napisao za one koji žele sopstveni sat na forumu.
Kod:
<html>
<head>
</head>
<body onload="getTheDate()">
<div id="vreme"></div>

<script type="text/javascript">
var baseURL = "http://www.dodaj.rs/";
var nums=[
  "f/16/J2/36xwg7Sz/0.png","f/1d/FG/2zB0N8u5/1.png","f/1C/7g/1SGo1CuC/2.png","f/c/3h/nTnRZFO/3.png","f/e/Kc/4ldu51MV/4.png",
  "f/3r/jr/3yvu4gNO/5.png","f/y/gA/4D7Wt9xr/6.png","f/3T/aG/2NTfeTGS/7.png","f/2L/yy/4FEyW7Q7/8.png","f/W/wR/2AdjK2G0/9.png"
];

function rePlace(tstr){
  var str = '';  var tmp = '';
  for (var i=0; i<tstr.length; i++) {
    tmp = tstr.charAt(i);
    if ('0123456789'.indexOf(tmp) != -1) {
      str += '<img src="'+baseURL+nums[tmp]+'" />';
    } else { str += '<span style="font-size:2em">'+tmp+'</span>'; }
  }
  return str;
}

function getTheDate(){
  var mydate = new Date();
  var time = ''+mydate.getHours()+':'+mydate.getMinutes();
      time = rePlace(time);
  document.getElementById("vreme").innerHTML=time;
}
</script>

</body>
</html>
Kako ga koristiti?
1. Ubacite samo javaskriptu u Javascript managment..
2. Udjete u template i odaberete gde želite da stavite javascriptu.
3. U body delu tog template stavite:
Kod:
<body onload="getTheDate()">
4. Ispod body taga odma div:
Kod:
<div id="vreme"></div>
Stavite ga u koji želite deo i radiće (naravno templates).


Who says anarchy, says negation of government;
Who says negation of government, says affirmation of the people;
Who says affirmation of the people, says individual liberty;
Who says individual liberty, says sovereignty of each;
Who says sovereignty of each, says equality;
Who says equality, says solidarity or fraternity;
Who says fraternity, says social order.

Mr.Joker
Administrator
Administrator

Broj poruka Broj poruka : 1709
D4U Novac D4U Novac : 1871
Reputacija Reputacija : 31
Godina Godina : 24
Lokacija Lokacija : Svet Foruma
Poso/dokolice Poso/dokolice : Programiranje


Pogledaj profil korisnika

Nazad na vrh Ići dole

Pogledaj prethodnu temu Pogledaj sledeću temu Nazad na vrh


 
Dozvole ovog foruma:
Ne možete odgovarati na teme u ovom forumu