Skrypt

[ Strona główna ] [ Do góry ] [ Praktyczny przykład ] [ Pierwsze archiwum ] [ Rozszerzanie projektu ] [ Dodatkowe elementy ] [ Archiwum i Ľródła ]

 

Strona główna
Do góry
<SCRIPT Language="JScript">
//Return current dir -- '' if in browser or path to CHM if in a CHM
//If in browser then - location.href=file:///d:/path/file.htm
//If in CHM then - location.href=mk:@MSITStore:D:\path\help.chm::/file.htm 
function GetCurrDir() {
  var X, Y, sl, a, ra, dir;
  ra = /::/;
  a = location.href.search(ra);
  if (a <= 0)   //no a CHM - return an empty string
    return('');

  //find the index of the first colon in the string 
  ra = /:/;
  a = location.href.search(ra);
  if (a == 2)
    X = 14;  //prefix = mk:@MSITStore:
  else
    X = 7;   //prefix = ms-its: 

  //find last back slash
  sl = "\\";
  Y = location.href.lastIndexOf(sl);
  dir = location.href.substring(X, Y);

  //UnEscape path - EG. Replace %20 with spaces
  var dir2 = unescape(dir) 
  return(dir2);
  }

</SCRIPT>


<SCRIPT Language="JScript">
var path = GetCurrDir();
if (path != '')
  path = path + '\\';
//alert(path);
document.writeln('<OBJECT ID="mediaPlayer" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" TYPE="application/x-oleobject">');
document.writeln('<PARAM NAME="fileName" VALUE="'+path+'pliczek.asf">');
document.writeln('<PARAM NAME="autoStart" VALUE="true"><PARAM NAME="showControls" VALUE="true"></OBJECT>');
</SCRIPT>

Wywoływany plik dĽwiękowy "pliczek.asf" jest tutaj zaznaczony czerwonym kolorem. Naturalnie takie zewnętrzne pliki dĽwiękowe należy dostarczać razem z archiwum CHM.