Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]js w js
spayk
post
Post #1





Grupa: Zarejestrowani
Postów: 364
Pomógł: 3
Dołączył: 29.11.2008

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


Mam skrypt js który wyswietla losowy element
jako element chciałem dac reklame google
jak umiescic skrypt js w skryci\ie js ;]
prościej było by w php ale nie moge używac php
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
spayk
post
Post #2





Grupa: Zarejestrowani
Postów: 364
Pomógł: 3
Dołączył: 29.11.2008

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


mam takie cos
  1. <script type="text/javascript">
  2. // <![CDATA[
  3. Array.prototype.random = function(limit)
  4. {
  5. if (typeof limit == 'undefined' || limit < 0) limit = 1;
  6. else if (!limit) limit = this.length;
  7. for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
  8. {
  9. do { var index = Math.random(); } while (index == 1);
  10. index = Math.floor(index * n);
  11. target.push(source[index]);
  12. source[index] = source[--n];
  13. }
  14. return target;
  15. }
  16.  
  17. document.write(new Array(
  18. // Tu wpisz kolejne elementy:
  19.  
  20. 'Tekst 1',
  21. 'Tekst 2',
  22. 'Tekst 3'
  23.  
  24. ).random().join(''));
  25. // ]]>


no i możesz mi napisac jak bedzie wygłodał powyższy kod przeribiony ?
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: 3.10.2025 - 18:41