MozTW 討論區
https://forum.moztw.org/

document ??
https://forum.moztw.org/viewtopic.php?f=13&t=7148
1 頁 (共 1 頁)

發表人:  iameason [ 2005-03-19, 13:41 ]
文章主題 :  document ??

以下是我下載了某音樂撥放程式所使用的某段語法:

代碼:
document.Music.Open(nowtrack1);


我用FireFox的JavaScript主控台找到了這段錯誤的語法,其他就沒什麼大問題了,不曉得這應該如何修改,麻煩各位了!

以下是該js檔所有的程式碼:

代碼:
var songtime1 = null;
var doFirstPlay = null;
var songPlaying = false;
var track = 0;
var songNum = null;
var songName = null;
var songTime = null;
var showTitle = null;
var count = 0;
var loop = false;
var playMode = null;
var restLength = null;

function init_bgm() {
   
   if (showTitle == null) { showTitle = 1; }
   switch (showTitle) {
      case 0 :
         document.form1.stitle.style.visibility = "hidden";
         document.form1.stitle.size = 1;
         break;
      case 1 :
         document.form1.stitle.style.visibility = "visible";
         break;
      case 2 :
         document.form1.stitle.style.visibility = "hidden";
         document.form1.stitle.size = 1;
         break;
      default :
         showTitle = 1;
   }
   if (playMode == null) { playMode = 0; }
   if (restLength == null) { restLength = 5; }
   if (doFirstPlay == null) { doFirstPlay = 1; }
   if (doFirstPlay == 1) { play(); }
}

function addbgm( url, title, time ) { //bgm 蹺陛
   if (songNum == null) { songNum = new Array(); count = 0;} else { count = songNum.length; }
   if (songName == null) { songName = new Array(); }
   if (songTime == null) { songTime = new Array(); }
   songNum[count] = url;
   if (title == null || title == '' ) { title1 = 'Track ' + (count + 1); } else { title1 = title; }
   songName[count] = title1;
   songTime[count] = time;
}

function chgLoop() {
   if (loop == false) {loop = true;}
   else {loop = false;}
}


function play() {
   if (songPlaying) {
   alert("歌曲已經播放中!");
   return;
   }
   
   switch (playMode) {
      case 0 :
         track = 0;
         break;
      case 1 :
         track = Math.floor(Math.random() * songNum.length);
         break;
      default :
         track = 0;
   }
chooseSong(track);
}

function stopTrack() {
   document.Music.Stop()
   if (songPlaying) {
   clearTimeout(songtime1);
   }
   else { alert("歌曲已經停止播放!"); return false;}
   songPlaying = false;
   updateTrack();
}

function checkloop( action ) {
   if ( loop == true ) { chooseSong(track); }
   else {
      switch (action) {
         case "next" :
            nextTrack();
            break;
         case "pre" :
            preTrack();
            break;
         default : 
            alert("這不是我們執行的命令範圍內!!\n\n請檢查主要程式是否有錯誤後再試一次!");
            stopTrack();
      }
   }
}

function chooseSong(aaa) { // 楷戲煎 霜蕾 勒傘嗨晦
   if (songPlaying) { //營儅醞檜塭賊..
   clearTimeout(songtime1); //顫歜嬴醒擊 薯棻.
   }
   track = aaa;
   //餌辨濠陛 詣賅腦堅 楷 廓蒂 殮溘賊...
   if(track > songNum.length - 1 || track < 0) { alert("這首歌曲的編號是不存在的!"); return false;}
      var nowtrack1 = songNum[track];
      document.Music.Open(nowtrack1);
      songPlaying = true;
      updateTrack();
      var t_time1 = songTime[track] + restLength;
      var t_time = t_time1 * 1000;
      songtime1 = setTimeout("checkloop('next')",t_time);
}

function nextTrack() {
   if (playMode == 1) { var num = Math.floor(Math.random() * songNum.length); }
   else {
      if(track == songNum.length - 1) { var num = 0; }
      else { var num = track + 1; }
   }
   chooseSong(num);
}

function preTrack() {
   if (playMode == 1) { var num = Math.floor(Math.random() * songNum.length); }
   else {
      if(track == 0) { var num = songNum.length - 1; }
      else { var num = track - 1; }
   }
   chooseSong(num);
}

function updateTrack() {
   if (songPlaying) {
   track_idx = track + 1;
   switch (showTitle) {
      case 0 :
         window.status = ('沒有使用顯示歌曲名稱的功能!'); return true;
         break;
      case 1 :
         document.form1.stitle.value = "" + track_idx + ". " + songName[track];
         break;
      case 2 :
         window.status = ('' + track_idx + '. ' + songName[track]); return true;
         break;
      default :
         window.status = ('沒有使用顯示歌曲名稱的功能!'); return true;
      }
   }
   else {
      switch (showTitle) {
      case 0 :
         window.status = ('BGM Player [stopped]'); return true;
         break;
      case 1 :
         document.form1.stitle.value = "BGM Player [stopped]";
         break;
      case 2 :
         window.status = ('BGM Player [stopped]'); return true;
         break;
      default :
         window.status = ('BGM Player [stopped]'); return true;
      }
   }
}

function m_list() { //bgm_sele.html的高度與寬度設定
   window.open('bgm_sele.html','LinksRemote','width=400,height=350,scrollbars=1,resizable=1');
}

發表人:  kourge [ 2005-03-19, 23:51 ]
文章主題 : 

你應該是用 exobud 吧...=.=|||

發表人:  iameason [ 2005-03-20, 00:09 ]
文章主題 :  ...

不是耶...
整個檔案只有該行是錯的啊?

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/