الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة في كود جافا سكريبت

بدأه جامعي جدة في 13 ديسمبر 2013 · 2 رد · 646 مشاهدة · في قسم البرمجة بــ Javascript
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع
 

السلام عليكم اخواني

 

كيف حالكم ؟؟

 

أتمنى مساعدتكم في حل هالكوود ..

 

kLjMJ.png505Te.png

#2

22 مشاهدة

 

0 ردود

 

:cry:  :cry:

#3

مع أن موضوعك مخالف لانك لم تحاول أن تكتب أنت الكود.

لكن أنا هساعدك يمكن تشوف الكود وتدرسة عشان تتعلم وتفهم الكود أتعمل أزاى (أتمنى أنك تدرسة)

 

أولا:  دة مثال أونلاين ممكن من خلالة تجرب الكود ( إضغط هنا )

 

 

ثانيا:

كود HTML

<table id="tab">    <tr>        <td></td>        <td class="bg">[a]</td>        <td class="bg"></td>        <td class="bg">[c]</td>        <td class="bg">[d]</td>    </tr>    <tr>        <td class="bg">[A]</td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>    </tr>    <tr>        <td class="bg"></td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>    </tr>    <tr>        <td class="bg">[C]</td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>    </tr>    <tr>        <td class="bg">[D]</td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>        <td>            <input type="checkbox" name="Rn[]" value="" />        </td>    </tr></table><br/><label class="bakg">Player Score</label> <input type="text" name="playerScore" id="playerScore" size="40" /><br/><label class="bakg">Message:</label>      <input type="text" name="message" id="message" size="40" /><br/><br/><input type="button" name="reset" id="reset" value="Reset" />

كود Javascript

var elements = document.getElementsByName('Rn[]');var elementLength = elements.length;var attempt = 3;var playerScoreElem = document.getElementById('playerScore');var messageElem = document.getElementById('message');var count = 0;var sum = 0;// When the page loadswindow.onload = function () {    for (var i = 0; i < elementLength; i++) {        elements.value = Math.floor(Math.random() * (15 - (-10) + 1) + (-10));        elements.onclick = function () {            calculate(this);        };    };};// When you click a reset buttondocument.getElementById('reset').onclick = function () {    count = sum = 0;    for (var i = 0; i < elementLength; i++) {        elements.value = Math.floor(Math.random() * (15 - (-10) + 1) + (-10));        elements.disabled = false;        elements.checked = false;        playerScoreElem.value = null;        messageElem.value = null;    }};// When you mark a checkboxfunction calculate(elem) {    if (elem.checked) {        sum += parseInt(elem.value);        elem.disabled = true;        if (count < attempt) {            count++;            if (count == attempt) {                playerScoreElem.value = sum;                for (var i = 0; i < elementLength; i++) {                    elements.disabled = true;                }                if (sum >= 15) {                    messageElem.value = "Congratulations you are an export.";                } else {                    messageElem.value = "You are still a beginner!.";                }            }        } else {            elem.checked = false;        }    }}

تم تعديل هذه المشاركة بواسطة مستر برمجة في 23 ديسمبر 2013 في 17:14

||||||||||||||||||||||||||||||||||||


||||||||||||||||||||||||||||||||||||


egypt_coa.gif


||||||||||||||||||||||||||||||||||||


||||||||||||||||||||||||||||||||||||

مواضيع مشابهة