הקוד
זה הקוד המקורי, כלומר לפני ששיניתי חלקים לעברית. בסוף איפה שכתוב START לשם נכנסות השאלות של החידון.
// // QueryString // function QueryString(key) { var value = null; for (var i=0;i<QueryString.keys.length;i++) { if (QueryString.keys==key) { value = QueryString.values; break; } } return value; } QueryString.keys = new Array(); QueryString.values = new Array(); function QueryString_Parse() { var query = window.location.search.substring(1); var pairs = query.split("&"); for (var i=0;i<pairs.length;i++) { var pos = pairs.indexOf('='); if (pos >= 0) { var argname = pairs.substring(0,pos); var value = pairs.substring(pos+1); QueryString.keys[QueryString.keys.length] = argname; QueryString.values[QueryString.values.length] = value; } } } QueryString_Parse(); // // Answer // function Answer_WriteHTML() { document.write('<INPUT type="radio" value="' + this.id + '" name="answers"> '); document.write('<span class="quizText">' + this.text + '</span><br>'); } function Answer(aID) { this.text = "New Answer"; this.id = aID; this.correct = false; this.WriteHTML = Answer_WriteHTML; } // // AnswerList // function AnswerList_NewAnswer() { var a = new Answer(this.sequenceID); this.sequenceID++; this.aList[this.aList.length] = a; // Optional Args: text, correct if (arguments.length > 0) a.text = arguments[0]; if (arguments.length > 1) a.correct = arguments[1]; if (this.editor) this.editor.AnswerSectionUpdate(); return a; } function AnswerList_Remove(id) { for (var i=0;i<this.aList.length;i++) { if (this.aList && this.aList.id == id) { this.aList = null; break; } } } function AnswerList_Find(id) { var result = null; for (var i=0;i<this.aList.length;i++) { if (this.aList && this.aList.id == id) { result = this.aList; break; } } return result; } function AnswerList_WriteHTML() { for (var i=0;i<this.aList.length;i++) this.aList.WriteHTML(); } function AnswerList(editor) { this.editor = editor; this.sequenceID = 0; this.aList = new Array(); this.NewAnswer = AnswerList_NewAnswer; this.Remove = AnswerList_Remove; this.Find = AnswerList_Find; this.WriteHTML = AnswerList_WriteHTML; } // // Question // function Question_NewAnswer(text,correct) { this.answerList.NewAnswer(text,correct); } function Question_WriteHTML() { document.write('<p class="quizQuestion">Q: ' + this.text + '</p>'); this.answerList.WriteHTML(); } function Question_GetCorrectAnswer(text,correct) { var result = ""; for (var i=0;i<this.answerList.aList.length;i++) { if (this.answerList.aList && this.answerList.aList.correct) { result = this.answerList.aList.text; break; } } return result; } function Question(qID,editor) { this.text = "New Question"; this.id = qID; this.editor = editor; this.answerList = new AnswerList(editor); this.NewAnswer = Question_NewAnswer; this.WriteHTML = Question_WriteHTML; this.GetCorrectAnswer = Question_GetCorrectAnswer; } // // QuestionList // function QuestionList_NewQuestion() { var q = new Question(this.sequenceID,this.editor); this.sequenceID++; this.qList[this.qList.length] = q; // Optional Args: text if (arguments.length > 0) q.text = arguments[0]; if (this.editor) this.editor.QuestionItemsAdd(q); return q; } function QuestionList_Remove(id) { for (var i=0;i<this.qList.length;i++) { if (this.qList && this.qList.id == id) {