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.

zufallslink

Empfohlene Antworten

Veröffentlicht

hi, eine Frage:

wie kann ich einen Zufallslink erstellen?

also so das ein Link auf verschiedene Seiten/Bilder was auch immer Linkt.

z.B:

bei jedem Besucher "gerade" auf Bild1

bei jedem Besucher "ungerade" auf Bild2

hm ich hoffe das is verständlich beschrieben.

geht des überhaupt mit reinem HTML oder brauchts da javascript?

danke schonma

Eine einfache Sache, jedes Mal wenn dieser Link angeklickt wird, öffnet er eine andere Seite, gern auch externe Seite.

Die möglichen Sprungziele müssen natürlich vorher festgelegt werden. Das ist gut für Überraschungen. Fügen Sie das Skript zwischen <head> und </head> Ihrer HTML-Datei ein:

<script language="JavaScript">

<!--

function picklink() {

var linknumber = 4 ; //Anzahl Ihrer Links

var linktext = "nolink.html" ;

var randomnumber = Math.random() ;

var linkselect = Math.round( (linknumber-1) * randomnumber) + 1 ;

if ( linkselect == 1)

{linktext="link1.html" }

if ( linkselect == 2)

{linktext="link2.html" }

if ( linkselect == 3)

{linktext="link3.html" }

if ( linkselect == 4)

{linktext="link4.html" }

return linktext;

}

// -->

</SCRIPT>
Aufruf für den <body>-Tag:
<a href="" onClick="this.href=picklink()">Klicken Sie Hier</A>

Quelle: www.drweb.de

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.