Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [solved][favicon] Czy da się zmieniać dynamicznie?
xamil
post
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 9.01.2005

Ostrzeżenie: (0%)
-----


Czy da się zmieniać dynamicznie favicon?

Nigdy w sumie o czymś takim nie słyszałem i przypuszczam, że odpowiedź będzie brzmieć, że nie ale zapytać zawsze można;) Kto wie może jest jakiś sposób.

Pozdrawiam, Kamil

Ten post edytował xamil 16.09.2006, 16:55:38
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
misterdexter
post
Post #2





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 15.06.2005

Ostrzeżenie: (0%)
-----


Kod
var link;
var icons = new Array('fav0','fav1','fav2','fav3');

function animate(nr){
  if(!nr) nr = 0;
  var headTag = document.getElementsByTagName('head')[0];
  if(link) headTag.removeChild(link);
  link = document.createElement('link');
  link.rel = 'shortcut icon';
  link.type = 'image/x-icon';
  link.href = icons[nr]+'.ico';
  headTag.appendChild(link);

  if(nr < icons.length-1){
    nnr = nr +1;
  } else{
    nnr = 0;
  }

  setTimeout("animate("+nnr+")","100");
}

animate();


example
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.12.2025 - 21:19