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.

JavaSkript Problem

Empfohlene Antworten

Veröffentlicht

Ich habe ein frameset und möchte sicherstellen, dass immer die richtige Navigationsseite zum dem entsprechenden Inhalt im mainFrame zu sehen ist.

Ich habe dann in beide Dateien ein Javaskript eingebaut:

in die Navigaitonsseite:

 <script type="text/javascript">

<!--

function anpassen() {

var aktuell = parent.mainFrame.location.href

if(aktuell = "seite1.htm") {

parent.mainFrame.location.href = "seite1.htm";

 }

}

// -->

</script>
Die Funktion wird beim body onload aufgerufen Bei der anderen Seite:
 <script type="text/javascript">

<!--

function anpassen() {

var aktuell = parent.leftFrame.location.href

if(aktuell = "links1.htm") {

document.write(parent.leftFrame.location.href)

}

}

// -->

</script>

Wird auch mit onload gestartet.

Ich hab aber jetzt eine Endlosschleife...warum?

Nachtrag:

In meiner Variablen steht nicht nur z.B. "links1.htm" sonder der gesamte pfad, wo die datei liegt, obwohl im frameset nur "links1.htm" als src angegeben ist.

Warum ist das so?

Ich würde das ganze eher so lösen:

Die Navigationsmenüs so:


<html>

<head>

<script type="text/javascript">

<!--


function oeffnen(wert) 

{

 var seite="seite"+wert+".html";

 var navi="nav"+wert+".html";

 parent.links.location.href = navi;

 parent.rechts.location.href = seite;

}


//-->

</script>


</head>


<body>

Navigation2<br>

<a href="javascript:oeffnen(1)">Seite1</a>

</body

</html>

anstelle der Zahl kann man ja auch nen string übergeben wie "home", "about" und so, da würde das JS dann so andern: var seite=wert+".html"; var navi=wert+"nav.html"; hab ich aber nicht ausprobiert ;) Das Frameset dazu:

<html><head><title>Test</title>


</head>

<frameset cols="30%,70%">

   <frame name="links" src="nav1.html">

   <frame name="rechts" src="seite1.html">

<noframes>

Ihr Browser unterstützt keine Frames!

</noframes>

</frameset>

</html>

hoffentlich kannst du damit was anfangen ;)

if(aktuell = "seite1.htm") {

parent.mainFrame.location.href = "seite1.htm";

}

huh? bedeutet: wenn die seite im mainFrame seite1.htm ist, dann soll die seite im mainFrame seite1.htm sein...da beisst sich wirklich was in den schwanz (wenn ich "schwanz") schreiben darf ;)

huh? bedeutet: wenn die seite im mainFrame seite1.htm ist, dann soll die seite im mainFrame seite1.htm sein...da beisst sich wirklich was in den schwanz (wenn ich "schwanz") schreiben darf ;)

ach ja, ich meinte natürlich != anstatt =

Werd mal Dalaya´s Tipp nachgehen

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.