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.

Null oder kein Objekt

Empfohlene Antworten

Veröffentlicht

Hi,

Ich habe ein Problem und ich hoffe ihr könnt mir da weiter helfen. Und zwar muss ich gerade ein kleines Script mit Javascript schreiben, das in bestimmten Zeitabständen das angezeigte Bild und den hinterlegten Link ändert (ein Kunde will einen Werbebanner :upps).

So weit funktioniert das ganze auch schon nur das mit dem hinterlegten Link will mir nicht klappen. Jedesmal wenn ich es probiere kommte folgende Fehlermeldung:

Zeile: 15

Zeichen: 5

Fehler: 'document.abc.a' ist Null oder kein Objekt

Und ich komm einfach nicht drauf an was es liegt. Ich weiß jetzt nicht genau was ich euch jetzt alles an code rein stellen soll also hab ich einfach mal alles kopiert. :hells:

<html>

<head>

<title>Timer</title>

</head>

<body>

<script type='text/javascript'>

//-----------------------------------function----------------------------------\\

function time() {

i++;

if(i <= stopper){

document.abc.a.href=bildlink[1][zaehler];

document.abc.bildchen.src = bild[1][zaehler];

if(i == stopper){

stopper += 5;

zaehler++;

if(zaehler == 3){

zaehler = 0;

}

}

}

}

//-------------------------------------Ende------------------------------------\\

var i = 0;

var stopper = 5;

var zaehler = 0;

//-----------------------------------Arrays------------------------------------\\

//------Bild-------\\

var bild = new Array(5);

for (var counter = 0; counter < bild.length; ++counter)

bild[counter] = new Array(10);

bild[1][0] = "/images/A.gif";

bild[1][1] = "/images/B.gif";

bild[1][2] = "/images/C.gif";

//------Link-------\\

var bildlink = new Array(5);

for (var counter1 = 0; counter1 < bildlink.length; ++counter1)

bildlink[counter1] = new Array(10);

bildlink[1][0] = "http://www.a.de";

bildlink[1][1] = "http://www.b.de";

bildlink[1][2] = "http://www.c.de";

//------------------------------------Ende-------------------------------------\\

setInterval('time()',1000);

</script>

<form name="abc">

<a name="a" href=""><img name="bildchen" src=""></a>

</form>

</body>

</html>

Ich hoff mal ihr könnt mir helfen.

Danke!

PS: Ich hoff mal ich habs hier richtig rein gestellt! :hells:

vorab: Java != JavaScript.

"a" ist ein äusserst schlechter name für einen anker. verwende einen aussagekräftigeren.

document.getElementById("dasistdernamemeineslinks").href="http://www.c.de/";

s'Amstel

Thx du bist meine Rettung! Hat auf anhieb geklappt deine Lösung :uli

PS: Hab auch den anker geändert :)

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.