تبلیغات در اینترنتclose
حل مشکل اسکریپت امتحان

زمان جاری : دوشنبه 29 مرداد 1397 - 7:33 بعد از ظهر
نام کاربری : پسورد : یا عضویت | رمز عبور را فراموش کردم



ارسال پاسخ
تعداد بازدید 662
نویسنده پیام
alamdar آفلاین


ارسال‌ها : 1
عضویت: 14 /11 /1394


حل مشکل اسکریپت امتحان
سلام من این کد رو برای ساختن یک آزمون ساز پیدا کردم
از ویژگی های این کد اینه که می تونه از بین 20 تا سوال 10 تا رو به صورت رندم انتخاب کنه
حالا می خواستم ببینم می شه کاری کرد بعد از اینکه دکمه ارسال رو زدیم پاسخ های صحیح سبز بشن و پاسخ های غلط قرمز و روبروی پاسخ های غلط جواب صحیح نمایش داده بشه



function Questions(divname) {
this.QText = new Array(20); // The questions
this.QAnswer = new Array(20); // The correct answers
this.QChoice = new Array(80); // The possible multi-choice values
this.thisAns = new Array(10); // The answers for this page
this.Answer = new Array(10); // The user\'s answers
this.anchor = document.getElementById(divname);

// OK, set the questions
this.QText[0] = \"What is the capital of Norway\";
this.QText[1] = \"What is the capital of Hungary\";
this.QText[2] = \"What is the capital of Cyprus\";
this.QText[3] = \"What is the capital of Libya\";
this.QText[4] = \"What is the capital of Kenya\";
this.QText[5] = \"What is the capital of Nigeria\";
this.QText[6] = \"What is the capital of Columbia\";
this.QText[7] = \"What is the capital of Barbados\";
this.QText[8] = \"What is the capital of Australia\";
this.QText[9] = \"What is the capital of Pakistan\";
this.QText[10] = \"What is the capital of Spain\";
this.QText[11] = \"What is the capital of England\";
this.QText[12] = \"What is the capital of Ireland\";
this.QText[13] = \"What is the capital of Sweden\";
this.QText[14] = \"What is the capital of Denmark\";
this.QText[15] = \"What is the capital of Poland\";
this.QText[16] = \"What is the capital of Italy\";
this.QText[17] = \"What is the capital of India\";
this.QText[18] = \"What is the capital of Canada\";
this.QText[19] = \"What is the capital of Portugal\";

// Now, set the possible choices
this.QChoice[0] = \"Bergen\";
this.QChoice[1] = \"Trondheim\";
this.QChoice[2] = \"Oslo\";
this.QChoice[3] = \"Haugesund\";
this.QChoice[4] = \"Warsaw\";
this.QChoice[5] = \"Budapest\";
this.QChoice[6] = \"Bucharest\";
this.QChoice[7] = \"Vienna\";
this.QChoice[8] = \"Crete\";
this.QChoice[9] = \"Nicosia\";
this.QChoice[10] = \"Athens\";
this.QChoice[11] = \"Saloniki\";
this.QChoice[12] = \"Tehran\";
this.QChoice[13] = \"Cairo\";
this.QChoice[14] = \"Tripoli\";
this.QChoice[15] = \"Baghdad\";
this.QChoice[16] = \"Nairobi\";
this.QChoice[17] = \"Mombasa\";
this.QChoice[18] = \"Zanzibar\";
this.QChoice[19] = \"Kampala\";
this.QChoice[20] = \"Laos\";
this.QChoice[21] = \"Harare\";
this.QChoice[22] = \"Douala\";
this.QChoice[23] = \"Lagos\";
this.QChoice[24] = \"Bogota\";
this.QChoice[25] = \"Cali\";
this.QChoice[26] = \"Medellin\";
this.QChoice[27] = \"Panama\";
this.QChoice[28] = \"Havana\";
this.QChoice[29] = \"Bridgetown\";
this.QChoice[30] = \"Kingston\";
this.QChoice[31] = \"Montego Bay\";
this.QChoice[32] = \"Sydney\";
this.QChoice[33] = \"Brisbane\";
this.QChoice[34] = \"Melbourne\";
this.QChoice[35] = \"Canberra\";
this.QChoice[36] = \"Kabul\";
this.QChoice[37] = \"Karachi\";
this.QChoice[38] = \"Islamabad\";
this.QChoice[39] = \"New Delhi\";
this.QChoice[40] = \"Bergen\";
this.QChoice[41] = \"Madrid\";
this.QChoice[42] = \"Oslo\";
this.QChoice[43] = \"Haugesund\";
this.QChoice[44] = \"London\";
this.QChoice[45] = \"Budapest\";
this.QChoice[46] = \"Bucharest\";
this.QChoice[47] = \"Vienna\";
this.QChoice[48] = \"Crete\";
this.QChoice[49] = \"Dublin\";
this.QChoice[50] = \"Athens\";
this.QChoice[51] = \"Saloniki\";
this.QChoice[52] = \"Tehran\";
this.QChoice[53] = \"Stockholm\";
this.QChoice[54] = \"Tripoli\";
this.QChoice[55] = \"Baghdad\";
this.QChoice[56] = \"Nairobi\";
this.QChoice[57] = \"Mombasa\";
this.QChoice[58] = \"Copenhagen\";
this.QChoice[59] = \"Kampala\";
this.QChoice[60] = \"Warsaw\";
this.QChoice[61] = \"Harare\";
this.QChoice[62] = \"Douala\";
this.QChoice[63] = \"Lagos\";
this.QChoice[64] = \"Bogota\";
this.QChoice[65] = \"Cali\";
this.QChoice[66] = \"Medellin\";
this.QChoice[67] = \"Rome\";
this.QChoice[68] = \"New Delhi\";
this.QChoice[69] = \"Bridgetown\";
this.QChoice[70] = \"Kingston\";
this.QChoice[71] = \"Montego Bay\";
this.QChoice[72] = \"Sydney\";
this.QChoice[73] = \"Brisbane\";
this.QChoice[74] = \"Ottawa\";
this.QChoice[75] = \"Canberra\";
this.QChoice[76] = \"Kabul\";
this.QChoice[77] = \"Karachi\";
this.QChoice[78] = \"Islamabad\";
this.QChoice[79] = \"Lisbon\";

// Set the correct answers
this.QAnswer[0] = 3;
this.QAnswer[1] = 2;
this.QAnswer[2] = 2;
this.QAnswer[3] = 3;
this.QAnswer[4] = 1;
this.QAnswer[5] = 4;
this.QAnswer[6] = 1;
this.QAnswer[7] = 2;
this.QAnswer[8] = 4;
this.QAnswer[9] = 3;
this.QAnswer[10] = 3; // these answers are wrong - check them yourself!
this.QAnswer[11] = 2;
this.QAnswer[12] = 2;
this.QAnswer[13] = 3;
this.QAnswer[14] = 1;
this.QAnswer[15] = 4;
this.QAnswer[16] = 1;
this.QAnswer[17] = 2;
this.QAnswer[18] = 4;
this.QAnswer[19] = 3;

}

Questions.prototype.generateQuiz = function() {
var QCount = 0;
var QNumber = 0;

// Initialise the \"questions available\" table
var QUsed = new Array(20);
for (QCount=0; QCount 0) {
this.anchor.removeChild(this.anchor.childNodes[0]);
}
}
}

// Add this to the DOM
Questions.prototype.AddQuestion = function(QNum, EntryNum) {
// This is really naughty: you should use DOM stuff, and not
// non-standard innerHtml ...
var Ix;
var HTMLBlob = \"\"
+ \"Question #\" + QNum + \":\"
+ \"\" + this.QText[QNum] + \"\"
+ \"-- Select an answer --\"
for (Ix=0; Ix

چهارشنبه 14 بهمن 1394 - 08:10
نقل قول این ارسال در پاسخ گزارش این ارسال به یک مدیر
amiricod آفلاین



ارسال‌ها : 1
عضویت: 9 /1 /1392


پاسخ : 1 RE پاسخ
بله میشه باید به یه کسی بدید که برنامه نویسی جاوا خونده
متاسفانه این نوع برنامه نویسی رو من بلد نیستم وگرنه درخدمتون بودم
یا میتونید توی یکی از سایت های زبان جاوا ثبت نام کنید و درخواست کد بدید
با تشکر
مدیریت جاوا کد

جمعه 17 اردیبهشت 1395 - 13:43
نقل قول این ارسال در پاسخ گزارش این ارسال به یک مدیر
ارسال پاسخ



برای ارسال پاسخ ابتدا باید لوگین یا ثبت نام کنید.


پرش به انجمن :