Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   JAVA: Über javascript nach"index.html" wechseln (https://www.delphipraxis.net/27038-java-ueber-javascript-nach-index-html-wechseln.html)

NikoMitDaMacht 3. Aug 2004 10:40


JAVA: Über javascript nach"index.html" wechseln
 
Ich hab in meiner html ein javascript mit dem ich eine midi starte/stoppe.
wenn der user auf stop drückt wird die midi angehalten und der browser soll die seite "index.html" wechseln.
Ich weiss leider dem befehl nicht :stupid:

Danke im voraus!

NicNacMan 3. Aug 2004 10:50

Re: JAVA: Über javascript nach"index.html" wechsel
 
so müsste es gehen:

window.location="index.html";

NikoMitDaMacht 3. Aug 2004 10:56

Re: JAVA: Über javascript nach"index.html" wechsel
 
Nicht ganz aber schon mal n' anfang
Hier mal die seite:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name=vs_defaultClientScript content="JavaScript">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);

  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = x;
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = x;
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
  if (method= "stop")(window.location="index.html"));
}
//-->
</script>

</head>

<body onLoad="MM_controlSound('play','document.midi','badboys.mid')" MS_POSITIONING="GridLayout">
<EMBED NAME='midi' SRC='badboys.mid' LOOP=false AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
<div align=center>
 <input id=Button1 onclick="MM_controlSound('stop','document.midi','badboys.mid')" type=button value="Klick hier um BadBoys zu stoppen" ? name="niko"></div></BODY></html>

NikoMitDaMacht 3. Aug 2004 11:00

Re: JAVA: Über javascript nach"index.html" wechsel
 
Bei
Code:
if (method= "stop)// soll das fenster gewechselt weden;
Wenn ich es so:
Code:
if (method= "stop")(window.location="index.html"));
mache wechselt er sofort die seite

Chewie 3. Aug 2004 11:04

Re: JAVA: Über javascript nach"index.html" wechsel
 
= ist bei Javascript eine Zuweisung. Der Vergleichsoperator heißt ==.

NikoMitDaMacht 3. Aug 2004 11:19

Re: JAVA: Über javascript nach"index.html" wechsel
 
Delphier eben :roll:
DANKE

NikoMitDaMacht 3. Aug 2004 11:21

Re: JAVA: Über javascript nach"index.html" wechsel
 
Noch ne kleine frage:
wenn die midi komplett apgespielt ist , wäre es nicht schlecht wenn er auch zur index.html zurück geht. Wäre das zu verwirklichen?

NicNacMan 3. Aug 2004 11:24

Re: JAVA: Über javascript nach"index.html" wechsel
 
du kannst das auch viel einfacher machen:

Code:
<html>
<head>
<script language="JavaScript">
  function loadpage() {window.location="index.html"}
</script>
</head>
<body>
<embed src="badboys.mid" loop="true" autostart="true" mastersound hidden="true" width="0" height="0"></embed>
<div align=center>
  <input onclick="loadpage()" type="button" value="Klick hier um BadBoys zu stoppen">
</body>
</html>


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz