![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 18 Pomógł: 0 Dołączył: 16.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witajcie, szukam takiego skryptu, co wyświetlałby losowo, link i pod nim obrazek, znalazłem na losowe obrazki, i text tez, ale nie wiem jak to złączyć... można zrobić coś takiego aby do skryptu wpisać dało sie byle co? Cos w stylu, aby bylo miejsce, w skrypcie na to co ma sie tam wyświetlić i mógłby być to np html coś w stylu
"<strong>Company Name</strong><a href="http://www.styleshout.com/">styleshout</a>" Dałoby sie? Tu macie skrypty radom image ![]() CODE <html> <head> <title>Random Image with Link</title> </head> <body> <script language="javascript"> <!-- var b1dis = "<a href=\""; var bdis = "\"><img src=\""; var edis = " width=\"110\" height=\"100\" alt=\"some text\" border=\"0\"></a>"; var rnumb = ""; var img = ""; rnumb += Math.floor(Math.random()*3); img = rnumb; if (img == "0") { document.write(b1dis+ "page1.html" +bdis+ "images/p1.gif\"" +edis); } if (img == "1") { document.write(b1dis+ "page2.html" +bdis+ "images/p2.gif\"" +edis); } if (img == "2") { document.write(b1dis+ "page3.html" +bdis+ "images/p3.gif\"" +edis); } // --> </script> </body> </html> Random Image with Link Radom text ![]() CODE <script LANGUAGE="JavaScript" TYPE="text/javascript"> var sc = 10; // Number of alternative strings var s = new Array(sc); // Array to hold alternative strings s[0] = "She won't live, of course. But then again ... who does?"; s[1] = "I seem to be having tremendous difficulty with my lifestyle."; s[2] = "Frog blast the vent core!"; s[3] = "Pizza is a lot like sex. When it's good, it's really good. " + "When it's bad, it's still pretty good."; s[4] = "unix soit qui mal y pense"; s[5] = "Wriggling grunion in your slipstream"; s[6] = "I'm shocked to hear it. The Hyperdyne 400 series always " + "were a bit twitchy."; s[7] = "I have the greatest enthusiasm for our mission, Dave."; s[8] = "Do not taunt Happy Fun Ball."; s[9] = "Do not look into laser with remaining good eye."; function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } var choice = pickRandom(sc); document.writeln("<TABLE WIDTH=460 ALIGN=CENTER><TR><TD>" + "<BLOCKQUOTE><BIG><B>" + s[choice] + "<" + "/B><" + "/BIG><" + "/BLOCKQUOTE>" + "<" + "/TD><" + "/TR><" + "/TABLE>"); </SCRIPT> Pozdrawiam i proszę o pomoc, może Wam sie wydawać ze o głupoty sie pytam, ale jestem w tym ciemny :C Pozdrawiam Ten post edytował inOs 8.02.2008, 15:47:19 |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 1 657 Pomógł: 125 Dołączył: 29.04.2006 Ostrzeżenie: (0%) ![]() ![]() |
Weź mi ten javascript
![]() O ile dobrze zrozumiałem problem najłatwiej jest dodać wszystko do jakiejś tablicy, np:
a następnie wyświetlić:
Ten post edytował radex_p 8.02.2008, 09:53:43 -------------------- |
|
|
![]()
Post
#3
|
|
![]() Grupa: Moderatorzy Postów: 4 465 Pomógł: 137 Dołączył: 26.03.2004 Skąd: Gorzów Wlkp. ![]() |
Popraw proszę tytuł topiku na zgodny z zasadami forum Przedszkole, dodaj bbcode oraz opisz, co chcesz zrobić, bo z Twojego posta niewiele wynika
-------------------- To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness; chaotic, confused, vulnerability, to inform yourself. Think for yourself. Question authority. |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 4 340 Pomógł: 542 Dołączył: 15.01.2006 Skąd: Olsztyn/Warszawa Ostrzeżenie: (0%) ![]() ![]() |
to ja moze dodam link
http://pl2.php.net/manual/en/function.shuffle.php -------------------- I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy. QueryBuilder, Mootools.net, bbcradio1::MistaJam http://www.phpbench.com/ |
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 18 Pomógł: 0 Dołączył: 16.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
Chodzi mi o to, aby można było zrobić takie coś, jak tutaj http://www.funner.pl/ po prawej stronie, albo tutaj http://www.maxmix.pl/ , porostu, losowe filmiki...
Kod <script type="text/javascript"> // <![CDATA[ Array.prototype.random = function(limit) { if (typeof limit == 'undefined' || limit < 0) limit = 1; else if (!limit) limit = this.length; for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++) { do { var index = Math.random(); } while (index == 1); index = Math.floor(index * n); target.push(source[index]); source[index] = source[--n]; } return target; } document.write(new Array( // Tu wpisz kolejne elementy: '<a href="index.html"> <img alt="" src="mini/inevofda.jpg" width="93" height="70" style="float: left" /></a><b><a href="index.html">Amazing Street Drummer</a></b><br /> El videos mas famoso del youtube</div> <p class="style22" style="width: 265px; height: 8px"> <img alt="" src="pod.gif" width="251" height="2" /></p> ', '<div style="height: 79px; width: 254px;"> <a href="index.html"> <img alt="" src="mini/huacyho.jpg" width="94" height="68" style="float: left" /></a><b><a href="index.html">Accidentes y hostias</a></b><br /> Uno de los videos de los accidentes mas graciosos</div> <p class="style22" style="width: 265px; height: 8px"> <img alt="" src="pod.gif" width="251" height="2" /></p> ', ' <div style="height: 79px; width: 254px;"> <a href="index.html"> <img alt="" src="mini/huacyho.jpg" width="94" height="68" style="float: left" /></a><b><a href="index.html">Accidentes y hostias</a></b><br /> Uno de los videos de los accidentes mas graciosos</div> <p class="style22" style="width: 265px; height: 8px"> <img alt="" src="pod.gif" width="251" height="2" /></p> ' ).random().join('')); // ]]> </script> Cos takiego udało mi sie wykombinować, ale nie działa, dlaczego? Kod <script> function nazwa_funkcji() { document.getElementById('blok').innerHTML = 'to co ma byc w bloku'; }</script> <a href=costam onClick="nazwa_funkcji()"> zobacz</a> <div id="blok"> Zawartosc bloku</div> Znalazłem tez to, nie wiem sam dokładnie jak to działa... Ten post edytował inOs 8.02.2008, 21:01:14 |
|
|
![]()
Post
#6
|
|
![]() Grupa: Zarejestrowani Postów: 1 657 Pomógł: 125 Dołączył: 29.04.2006 Ostrzeżenie: (0%) ![]() ![]() |
Nie rozumiem, ale dlaczego chcesz koniecznie to zrobić w JavaScript? Co do twojego przykładu, to zobacz w kursie, czy nie zrobiłeś literówki - nie jestem zbyt dobry w JavaScript, który rozróżnia wielkość liter, np. GetElementByID i getElementById to inne funkcje...
-------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 8.07.2025 - 09:25 |