2013-05-08 16 views
-4

我在Javascript寫了一個事件管理器代碼。:(但出事了,代碼不working.anyone請幫我我用Javascript編寫了一個活動管理器代碼。 :(但出事了

CODE

var plan = prompt("Hello , Made a week plan. Type the week name to add a event"); 
var week = [saturday, sunday, monday, tuesday, wednesday, thrusday, friday]; 
var saturday = ''; 



if (plan == saturday) { 
    var saturday = prompt("What will you do in saturday?"); 
} 

var getknow = prompt("Do you want to cheack the schedule? Type the week name"); 
if (getknow == saturday) { 
    alert(saturday); 
} 
+3

你嘗試過調試 – 2013-05-08 10:18:55

+1

[週六,週日,週一,週二,週三,thrusday,週五];這些變量,使用引號的字符串:?「星期六」,「星期天」等等...... – Cristy 2013-05-08 10:20:31

+0

另外,如果你甚至沒有使用它,你爲什麼要對''''數組進行轉換? – Cristy 2013-05-08 10:22:09

回答

0

這裏你想要什麼:)

var plan=prompt("Hello , Made a week plan. Type the week name to add a event"); 
var week = ['saturday' , "sunday" , "monday" , "tuesday" , "wednesday" , "thrusday" , "friday"]; 
//   var saturday = ''; 

     if(plan == "saturday") { 

      var saturday=prompt("What will you do in saturday?"); 
     } 

     var getknow=prompt("Do you want to cheack the schedule? Type the week name"); 

     if (getknow == saturday) { 

      alert(saturday); 

     } 
+0

非常感謝:) – 2013-05-08 10:26:44

+0

然後請將此問題標記爲答案... – Yogeshkumar 2013-05-08 10:28:34

+1

變量'星期六'將超出範圍,如果,計劃==「星期六」條件失敗。 – 2013-05-08 10:29:54

相關問題