Bilder slideshow
skymuss
- javascript
Ich versuche schon seit lägerem eine slideshow funktion
in meine website eizubauen. leider funktioniert der
quell-code nicht. könnt ihr mir helfen ??
thx
skymuss
<script type="text/javascript" language="JavaScript"> <!-- var url = new Array(); var link = new Array(); url[0]="http://127.0.0.1/temp/TN0f141f795fa84f841e9c63fbf10008d0.png"; link[0]="http://127.0.0.1/show.php?image=0f141f795fa84f841e9c63fbf10008d0.png"; url[1]="http://127.0.0.1/temp/TN0595d4ce3f1df82da2df4ae414d56c77.jpg"; link[1]="http://127.0.0.1/show.php?image=0595d4ce3f1df82da2df4ae414d56c77.jpg"; url[2]="http://127.0.0.1/temp/TNcf205d80b2a2b8c7043f4ba648c4ebee.jpg"; link[2]="http://127.0.0.1/show.php?image=cf205d80b2a2b8c7043f4ba648c4ebee.jpg"; url[3]="http://127.0.0.1/temp/TN8dc803b7f528614998912232ac72ad9f.jpg"; link[3]="http://127.0.0.1/show.php?image=8dc803b7f528614998912232ac72ad9f.jpg"; url[4]="http://127.0.0.1/temp/TN978206fe0380ae9edcfa20d17c317d2e.jpg"; link[4]="http://127.0.0.1/show.php?image=978206fe0380ae9edcfa20d17c317d2e.jpg"; url[5]="http://127.0.0.1/temp/TN33490ca45993640ed5ac3c7018a13618.jpg"; link[5]="http://127.0.0.1/show.php?image=33490ca45993640ed5ac3c7018a13618.jpg"; url[6]="http://127.0.0.1/temp/TN58a4d7cdad020df706db950660b61f69.jpg"; link[6]="http://127.0.0.1/show.php?image=58a4d7cdad020df706db950660b61f69.jpg"; url[7]="http://127.0.0.1/temp/TN5b61bb4a51633cd05706430602400655.jpg"; link[7]="http://127.0.0.1/show.php?image=5b61bb4a51633cd05706430602400655.jpg"; url[8]="http://127.0.0.1/temp/TNfc6632068d7facdf8e02d1c45dc6b505.jpg"; link[8]="http://127.0.0.1/show.php?image=fc6632068d7facdf8e02d1c45dc6b505.jpg"; url[9]="http://127.0.0.1/temp/TN5852a5aa6042856233271b30d3af2a48.jpg"; link[9]="http://127.0.0.1/show.php?image=5852a5aa6042856233271b30d3af2a48.jpg"; url[10]="http://127.0.0.1/temp/TN20c757d278680da83e8119db4bad2c7f.jpg"; link[10]="http://127.0.0.1/show.php?image=20c757d278680da83e8119db4bad2c7f.jpg"; url[11]="http://127.0.0.1/temp/TNe998ec265c242a7b2424ec8c5d143d34.jpg"; link[11]="http://127.0.0.1/show.php?image=e998ec265c242a7b2424ec8c5d143d34.jpg"; url[12]="http://127.0.0.1/temp/TNe06e130eccecf2cc6f4bd0c015a5f54f.jpg"; link[12]="http://127.0.0.1/show.php?image=e06e130eccecf2cc6f4bd0c015a5f54f.jpg"; url[13]="http://127.0.0.1/temp/TN664c5690482a21a7b6d86fd6f9ccaa64.jpg"; link[13]="http://127.0.0.1/show.php?image=664c5690482a21a7b6d86fd6f9ccaa64.jpg"; url[14]="http://127.0.0.1/temp/TN524fa6cb7f12915e62b719bc9c808bd2.jpg"; link[14]="http://127.0.0.1/show.php?image=524fa6cb7f12915e62b719bc9c808bd2.jpg"; url[15]="http://127.0.0.1/temp/TN9fa04d26a629c6c64dded10f28091c7f.jpg"; link[15]="http://127.0.0.1/show.php?image=9fa04d26a629c6c64dded10f28091c7f.jpg"; url[16]="http://127.0.0.1/temp/TN34b3bfc342429cf319179d5738edde12.jpg"; link[16]="http://127.0.0.1/show.php?image=34b3bfc342429cf319179d5738edde12.jpg"; url[17]="http://127.0.0.1/temp/TN6c1b1d26a59b2146aa4d4d532c693835.jpg"; link[17]="http://127.0.0.1/show.php?image=6c1b1d26a59b2146aa4d4d532c693835.jpg"; url[18]="http://127.0.0.1/temp/TN6ad6dac5d728e15df5cfaf749cd91157.jpg"; link[18]="http://127.0.0.1/show.php?image=6ad6dac5d728e15df5cfaf749cd91157.jpg"; url[19]="http://127.0.0.1/temp/TN070d3a1d68ae43dd480e1fdb71904914.jpg"; link[19]="http://127.0.0.1/show.php?image=070d3a1d68ae43dd480e1fdb71904914.jpg"; url[20]="http://127.0.0.1/temp/TNaf6cddc84f1aba4fa492cdb8bf17ab69.jpg"; link[20]="http://127.0.0.1/show.php?image=af6cddc84f1aba4fa492cdb8bf17ab69.jpg"; url[21]="http://127.0.0.1/temp/TNe5726771fdd179af07dd9e6b73de1ceb.jpg"; link[21]="http://127.0.0.1/show.php?image=e5726771fdd179af07dd9e6b73de1ceb.jpg"; url[22]="http://127.0.0.1/temp/TNaee9567277ad17721faf206eae17770a.jpg"; link[22]="http://127.0.0.1/show.php?image=aee9567277ad17721faf206eae17770a.jpg"; url[23]="http://127.0.0.1/temp/TNaaf07d7efed3d157dd91fec7dafdf8f2.jpg"; link[23]="http://127.0.0.1/show.php?image=aaf07d7efed3d157dd91fec7dafdf8f2.jpg"; url[24]="http://127.0.0.1/temp/TN15a72a453ca6d69e8c3a57dc78130778.jpg"; link[24]="http://127.0.0.1/show.php?image=15a72a453ca6d69e8c3a57dc78130778.jpg"; url[25]="http://127.0.0.1/temp/TN2ed4470b377f987644025275f5faea09.jpg"; link[25]="http://127.0.0.1/show.php?image=2ed4470b377f987644025275f5faea09.jpg"; url[26]="http://127.0.0.1/temp/TNc9c6dfc0d640c400d4bff03614623ff9.jpg"; link[26]="http://127.0.0.1/show.php?image=c9c6dfc0d640c400d4bff03614623ff9.jpg"; url[27]="http://127.0.0.1/temp/TNa67a4199d2c02cf73da75d1ec9946f42.jpg"; link[27]="http://127.0.0.1/show.php?image=a67a4199d2c02cf73da75d1ec9946f42.jpg"; url[28]="http://127.0.0.1/temp/TN22373a4f9f4b4a772f2f2e10876b2ca8.jpg"; link[28]="http://127.0.0.1/show.php?image=22373a4f9f4b4a772f2f2e10876b2ca8.jpg"; url[29]="http://127.0.0.1/temp/TNc2b63ff87e22ea7225fde4aed42fad59.jpg"; link[29]="http://127.0.0.1/show.php?image=c2b63ff87e22ea7225fde4aed42fad59.jpg"; url[30]="http://127.0.0.1/temp/TN0100e46891763941496ae2e2f6f1363f.jpg"; link[30]="http://127.0.0.1/show.php?image=0100e46891763941496ae2e2f6f1363f.jpg"; url[31]="http://127.0.0.1/temp/TN8d8dea3824ea786642d4b42957c910fe.jpg"; link[31]="http://127.0.0.1/show.php?image=8d8dea3824ea786642d4b42957c910fe.jpg"; url[32]="http://127.0.0.1/temp/TNb0f23360908ce62bfdd19294d0e88a09.jpg"; link[32]="http://127.0.0.1/show.php?image=b0f23360908ce62bfdd19294d0e88a09.jpg"; url[33]="http://127.0.0.1/temp/TN27b6df91d15be6221cdc3ed10ba8f53c.jpg"; link[33]="http://127.0.0.1/show.php?image=27b6df91d15be6221cdc3ed10ba8f53c.jpg"; url[34]="http://127.0.0.1/temp/TNe64c5f05c951948580af6755913554d0.jpg"; link[34]="http://127.0.0.1/show.php?image=e64c5f05c951948580af6755913554d0.jpg"; url[35]="http://127.0.0.1/temp/TN0b079bcc876894c0ff8a4bfed8c00968.jpg"; link[35]="http://127.0.0.1/show.php?image=0b079bcc876894c0ff8a4bfed8c00968.jpg"; url[36]="http://127.0.0.1/temp/TN1881c5f692713616b484e274b999a917.jpg"; link[36]="http://127.0.0.1/show.php?image=1881c5f692713616b484e274b999a917.jpg"; url[37]="http://127.0.0.1/temp/TNd3daeea9df89938b5d04957d102d3805.jpg"; link[37]="http://127.0.0.1/show.php?image=d3daeea9df89938b5d04957d102d3805.jpg"; url[38]="http://127.0.0.1/temp/TN7093e3a0049e70d285ad7cb7c00b288a.jpg"; link[38]="http://127.0.0.1/show.php?image=7093e3a0049e70d285ad7cb7c00b288a.jpg"; url[39]="http://127.0.0.1/temp/TNc52697bc41431ea73dbc1d62b51a57ee.jpg"; link[39]="http://127.0.0.1/show.php?image=c52697bc41431ea73dbc1d62b51a57ee.jpg"; var imageid = 0; function add() { imageid++; document.getElementById("slideshow").innerHTML = "<a href='"+link[imageid]+"'><img src='"+url[imageid]+"'></a>"; } function make() { window.clearTimeout(imageid); add(); imageid = window.setTimeout("make()", 3000); } make(); //--> </script> <div id='slideshow'></div>
Ich versuche schon seit lägerem eine slideshow funktion
in meine website eizubauen. leider funktioniert der
quell-code nicht. könnt ihr mir helfen ??
Sicher, aber nicht bei dieser Codewüste und ohne vernünftige Fehlerbeschreibung.
url[0]="http://127.0.0.1/temp/TN0f141f795fa84f841e9c63fbf10008d0.png"; link[0]="http://127.0.0.1/show.php?image=0f141f795fa84f841e9c63fbf10008d0.png";
Und 127.0.0.1 funktioniert sowieso nicht außerhalb deines lokalen Netzwerks, siehe http://de.wikipedia.org/wiki/Localhost.
JJ
Hi skymuss!
Ich erschaudere ehrfürchtig vor soviel "hardcoding" Ausdauer.
Was hältst du davon:
var imgName = new Array();
imgName.push("0f141f795fa84f841e9c63fbf10008d0.png");
...
imgName.push("c52697bc41431ea73dbc1d62b51a57ee.jpg");
var baseURL = "http://127.0.0.1/temp/TN"
var baseLink = "http://127.0.0.1/show.php?image=";
var imageid = 0;
function step()
{
var link = baseLink+imgName[imageid];
var url = baseURL+imgName[imageid];
document.getElementById("slideshow").innerHTML = "<a href='"+link+"'><img src='"+url+"'></a>";
imageid++;
if (imageid<imgName.length)
imageid = window.setTimeout("step()", 3000);
}
step();
//--> </script>
<div id='slideshow'></div>
Ob das eine gute Lösung ist, müßten man testen:
Viele Grüsse,
Richard
Ja okay danke schon mal werds gleich mal testen gehen. ;-).
// Ich erschaudere ehrfürchtig vor soviel "hardcoding" Ausdauer.
Der war nicht schlecht.
Diese links generiere ich haupsächlich mit php.
// wie oder warum ist .push besser ??