Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammedTsmu authored Jun 19, 2023
1 parent c254b67 commit 6a19e0f
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 0 deletions.
44 changes: 44 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var table = document.getElementById("multiplicationTable");
var userInput = document.getElementById("user-input");
var correctAnswer = document.getElementById("correct-input");
var isUserCorrect = document.getElementById("is-user-correct");
var output = document.getElementById("result");
var btn = document.getElementById("btn");
var one = document.getElementById("one");
var two = document.getElementById("two");
var three = document.getElementById("three");
var four = document.getElementById("four");
var five = document.getElementById("five");
var six = document.getElementById("six");
var seven = document.getElementById("seven");
var eight = document.getElementById("eight");
var nine = document.getElementById("nine");
var ten = document.getElementById("ten");


// correctAnswer.addEventListener("input", function () {
// correctAnswer.addEventListener("change", function () {
btn.addEventListener("click", function () {

// multiplicationOutput output
var result = userInput.value * table.value;



if (userInput.value == "") {
isUserCorrect.innerHTML = "<div class='alert'>ادخل رقم في الاعلى</div>";
} else if (correctAnswer.value == result) {
isUserCorrect.innerHTML = "<div class='green'>الاجابة صحيحة</div>";
}
else {
isUserCorrect.innerHTML = "<div class='red'>الاجابة خاطئة</div>";
}

output.textContent = "النتيجة: " + table.value + " * " + userInput.value + " = " + result;


// Reset output in case of empty value
if (userInput.value == "") {
output.textContent = "النتيجة: ";
}
});
3 changes: 3 additions & 0 deletions calculator-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>اختبار جدول الضرب</title>
<link rel="stylesheet" href="./style.css">
<link rel="shortcut icon" href="./calculator-fill.svg" type="image/x-icon">
</head>

<body>
<div class="container">

<h1 class="title">اختبار جدول الضرب</h1>

<div class="table-options">
<label for="multiplicationTable">أختر جدول</label>
<select id="multiplicationTable">
<option id="one" value="1">1</option>
<option id="two" value="2">2</option>
<option id="three" value="3">3</option>
<option id="four" value="4">4</option>
<option id="five" value="5">5</option>
<option id="six" value="6">6</option>
<option id="seven" value="7">7</option>
<option id="eight" value="8">8</option>
<option id="nine" value="9">9</option>
<option id="ten" value="10">10</option>
</select>
</div>

<div class="input">
<label for="user-input">الرقم المراد ضربه</label>
<input type="number" name="user-input" id="user-input"><br><br>
<label for="correct-input">ادخل الأجابة الصحيحة</label>
<input type="number" name="correct-input" id="correct-input">
</div>

<div class="results">
<h2 id="is-user-correct"></h2>
<h2 id="result">النتيجة: </h2>
</div>

<div class="button"><button type="submit" id="btn">ابدأ الاختبار</button></div>
</div>


<script src="./app.js"></script>
</body>

</html>
89 changes: 89 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
body {
direction: rtl;
}
/* Mobile style */
.container {
display: grid;
grid-template-areas:
"hd"
"con1"
"con2"
"result"
"btn";
color: aliceblue;
}

/* computer style */
@media (min-width: 768px) {
.container {
grid-template-areas:
"hd"
"con1 con2"
"result"
"btn";
grid-template-rows: minmax(200px, 1fr);
}
}

.container > * {
padding: 10px;
margin: 0;
background-color: navy;
}

.title {
grid-area: hd;
background-color: #333;
}
.table-options {
grid-area: con1;
}
.input {
grid-area: con2;
}
.results {
background-color: #333;
grid-area: result;
}
.button {
grid-area: btn;
}

.red {
background-color: red;
padding: 10px;
}
.green {
background-color: green;
padding: 10px;
}
.alert {
background-color: gold;
color: #333;
padding: 10px;
}
input,
select,
label,
button {
padding: 10px;
font-size: 24px;
}
input,
select,
label,
button,
.green,
.red,
.alert {
transition: all 0.5s linear;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
}

0 comments on commit 6a19e0f

Please sign in to comment.