Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Probleme mit zwei parallenen Bildergalerien auf einer Seite

Empfohlene Antworten

Veröffentlicht

Halllo zusammen,

ich bastle gerade an einer HP wo eine Slideshow angezeigt werden soll, soweit komme ich auch noch ohne weiteres zurecht, wenn ich allerdings auf einer Seite zwei Slideshows haben will und den Code zweimal nutze (er wird über zwei PHP seiten eingebuden) schalten die bilder nicht mehr weiter :/

Da ich fast keine Ahnung von JS habe komme ich da leider überhaupt nicht weiter, vielleicht ist ja hier jemand Anwesend der mir sagen kann warum das so nicht funktioniert.

Inhalt der ersten PHP Datei

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!--

var timeDelay = 5;

var Pix = new Array

("1.png"

,"2.png"

);

var howMany = Pix.length;

timeDelay *= 1000;

var PicCurrentNum = 0;

var PicCurrent = new Image();

PicCurrent.src = Pix[PicCurrentNum];

function startPix() {

setInterval("slideshow()", timeDelay);

}

function slideshow() {

PicCurrentNum++;

if (PicCurrentNum == howMany) {

PicCurrentNum = 0;

}

PicCurrent.src = Pix[PicCurrentNum];

document["ChangingPix"].src = PicCurrent.src;

}

// End -->

</script>

</HEAD>

<body OnLoad="startPix()">

<img name="ChangingPix" src="1.png"></body>
Inhalt der zweiten PHP Datei
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!--

var timeDelay2 = 5;

var Pix2 = new Array

("3.png"

,"4.png"

);

var howMany2 = Pix2.length;

timeDelay2 *= 1000;

var PicCurrentNum2 = 0;

var PicCurrent2 = new Image();

PicCurrent2.src = Pix[PicCurrentNum2];

function startPix2() {

setInterval("slideshow2()", timeDelay2);

}

function slideshow2() {

PicCurrentNum2++;

if (PicCurrentNum2 == howMany2) {

PicCurrentNum2 = 0;

}

PicCurrent2.src = Pix2[PicCurrentNum2];

document["ChangingPix2"].src = PicCurrent2.src;

}

// End -->

</script>

</HEAD>

<body OnLoad="startPix2()">

<img name="ChangingPix2" src="3.png"></body>

binde ich jeweils nur eine PHP Datei ein Funktioniert alles Prima, binde ich aber mal die zweite mit ein wird nur das StartBild angezeigt.

Die einzige vermuttung die ich hatte war das es an der setInterval Funktion liegen könnte, aber das rausnehmen selbiger bei einer Datei hat auch keinen Unterschied bewirkt.

Wenn ihr mir sagen könnt was falsch ist, wie ich es abändern muss, oder mir das so erklären könnt das ich es selber beheben kann wäre ich euch wirkilch mega Dankbar.

Gruß

chris

P.S.: Danke fürs durchlesen

  • 2 Wochen später...

du hast 2x <body OnLoad="startPix2()"> drinnen vllt soltlest du darauß

<body OnLoad="startPix(); startPix2();"> machen, da es sonst kein valides HTML mehr ist.

Genauso hast du dann zwei HEAD Berieche.

Vielleicht liegt es daran.

mfg Maxi

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.