Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php, js]Losowy skrypt
inOs
post 8.02.2008, 03:07:50
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 smile.gif


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 smile.gif
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
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 10:30