Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js bs03 #56

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<meta charset="UTF-8">
</head>
<body>
<script src="step_1.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<meta charset="UTF-8">
</head>
<body>
<script src="step_2.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<meta charset="UTF-8">
</head>
<body>
<script src="step_03.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion 03_Exercises/03_JavaScript/javascript-basics-01/Step_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<label for="name">name : </label><input type="text" name="name" id="name"/>
<label for="surname">surname : </label><input type="text" name="surname" id="surname"/>
<label for="city">city : </label><input type="text" name="city" id="city"/>
<button name="validate" id="validate">Validate</button>
<button name="validate" id="validate" onclick="person()">Validate</button>
</form>
<script src="step_04.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion 03_Exercises/03_JavaScript/javascript-basics-01/Step_5.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<form>
<label for="first_number">first number : </label><input type="text" id="first_number" name="first_number"/><br/>
<label for="second_number">second number : </label><input type="text" id="second_number" name="second_number"/><br/>
<button id="validate" name ="validate">validate</button>
<button id="validate" name ="validate" onclick="muiltiply()">validate</button>
</form>
<script src="../javascript-basics-01/step_05.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion 03_Exercises/03_JavaScript/javascript-basics-01/Step_6.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<form>
<label for="first_number">first number : </label><input type="text" id="first_number" name="first_number"/><br/>
<label for="second_number">second number : </label><input type="text" id="second_number" name="second_number"/><br/>
<button id="validate" name ="validate">validate</button>
<button id="validate" name ="validate" onclick="Division()">validate</button>
</form>
<script src="../javascript-basics-01/step_06.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion 03_Exercises/03_JavaScript/javascript-basics-01/Step_7.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<form>
<label for="shoe_size">shoe size : </label><input type="text" id="shoe_size" name="shoe_size"/><br/>
<label for="year">Birth year : </label><input type="text" id="year" name="year"/><br/>
<button id="validate" name="validate">validate</button>
<button id="validate" name="validate" onclick="fxn()">validate</button>
</form>
<script src="./step_07.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion 03_Exercises/03_JavaScript/javascript-basics-01/Step_8.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<body>
<form>
<label for="age">your age : </label><input type="text" id="age" name="age"/><br/>
<button id="validate" name="validate">validate</button>
<button id="validate" name="validate" onclick="numb()">validate</button>
</form>
</body>
<script src="step_08.js"></script>
</html>
6 changes: 6 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_03.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var nickname = prompt("Enter your name ");
if (nickname == '') {
alert("wrong format")
}
else
alert("Welcome " +nickname) ;
7 changes: 7 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_04.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

function person(){
const name1 = document.getElementById('name').value;
const surname = document.getElementById('surname').value;
const city = document.getElementById('city').value;
alert("name :" + name1 +"\n" + "surname :" + surname + "\n" + "city :" +city) ;
}
9 changes: 9 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_05.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@



function muiltiply(){
var x = document.getElementById('first_number').value;
var y = document.getElementById('second_number').value;
var result = x*y
alert("The final answer is :" +result) ;
}
7 changes: 7 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_06.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

function Division(){
var x = document.getElementById('first_number').value;
var y = document.getElementById('second_number').value;
var remainder = x%y
alert("The final answer is :" +remainder) ;
}
5 changes: 5 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_07.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function fxn(){
var shoe_size = document.getElementById('shoe_size').value;
var year = document.getElementById('year').value;
var result = (shoe_size *2) +5 * 50 - year + 1766 ;
alert("the result is " +result); }
8 changes: 8 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_08.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function numb()
{
var num1 = document.getElementById("age").value;
if(num1 > 18){
alert("you are over 18") }
else
alert("you are under 18") ;
}
2 changes: 2 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var name1 ;
alert(name1);
5 changes: 5 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-01/step_2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var name1 = 'Kanj'
var surname = 'Hasan'
var city = 'beirut'

alert("name :" +name1 +"\n" + "surname :" + surname + "\n" + "city :" +city)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title>Step 1</title>
</head>
<body>
<img src="images/image1.jpg" id="image1" />
<img src="images/image1.jpg" id="image1"onmouseover="mouseover()" ;/>
<script src="../step 1/step1.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var image1 ;

function mouseover() {
image1 = document.querySelector('img').src ="./images/image1_2.jpg";
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<body>
<form>
<label for="name">Your name : </label><input type="text" name="name" value="" id="name"/>
</form>
</form>

</body>
<script src="./step_2.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var x = document.querySelector('input');
x.onblur = function(){
alert("Thank you for participating!")
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<form>
<label for="name">Your name : </label><input type="text" name="name" value="" id="name"/>
</form>
<div id="out" ></div>
</body>
<script src="../step 3/step_03.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let input = document.getElementById('name');
let out = document.getElementById('out');

input.onkeyup = function() {
out.innerHTML = input.value;
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<label for="name">Your name : </label><input type="text" name="name" value="Doe" id="name" />
<label for="surname">Your surname : </label><input type="text" name="surname" value="John" id="surname" />
<label for="city">Your city : </label><input type="text" name="city" value="New York" id="city" />
<button type="button" name="button">Reset</button>
<button type="button" name="button" onclick="promptMe()">Reset</button>
</form>
</body>
<script src="step_04.js"></script>
</html>
14 changes: 14 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-02/step 4/step_04.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

let btnclear = document.querySelector('button') ;
let input = document.querySelectorAll('input');

function promptMe() {
var confirmAction = confirm("Are you sure to execute this action?");
if (confirmAction)
btnclear.addEventListener('click' , () =>{
input.forEach(input => input.value= '' );
});
else {
alert("Action canceled");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
</head>
<body>
<div class="container">
<img src="images/image1.jpg" id="image1" />
<img src="images/image2.jpg" id="image2" />
<img src="images/image3.jpg" id="image3" />
<img src="images/image4.jpg" id="image4" />
<img src="images/image5.jpg" id="image5" />
<img src="images/image1.jpg" id="image1" onmouseover="mouseover()" />
<img src="images/image2.jpg" id="image2" onmouseover="mouseover()" />
<img src="images/image3.jpg" id="image3" onmouseover="mouseover()"/>
<img src="images/image4.jpg" id="image4" onmouseover="mouseover()"/>
<img src="images/image5.jpg" id="image5" onmouseover="mouseover()"/>
</div>
</body>
<script src="step_05.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

function mouseover() {
image1 = document.querySelector('#image1').src = "images/image2.jpg";
image2 = document.querySelector('#image2').src = "images/image3.jpg";
image3 = document.querySelector('#image3').src = "images/image4.jpg";
image4 = document.querySelector('#image4').src = "images/image5.jpg";
image5 = document.querySelector('#image5').src = "images/image1.jpg";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
<title>Step 6</title>
</head>
<body>
<img src="images/image1.jpg" id="image1" />
<img src="images/image2.jpg" id="image2" />
<img src="images/image3.jpg" id="image3" />
<img src="images/image4.jpg" id="image4" />
<img src="images/image5.jpg" id="image5" />
</body>
<img src="images/image1.jpg" id="image1" onmouseover="mouseover() " onmouseout="mouseout()">
<img src="images/image2.jpg" id="image2" onmouseover="mouseover() " onmouseout="mouseout()">
<img src="images/image3.jpg" id="image3" onmouseover="mouseover() " onmouseout="mouseout()">
<img src="images/image4.jpg" id="image4" onmouseover="mouseover() " onmouseout="mouseout()">
<img src="images/image5.jpg" id="image5" onmouseover="mouseover() " onmouseout="mouseout()">
</body>>
<script src="step_06.js"></script>>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

function mouseout() {
image1 = document.querySelector('#image1').src = "images/image2.jpg";
image2 = document.querySelector('#image2').src = "images/image3.jpg";
image3 = document.querySelector('#image3').src = "images/image4.jpg";
image4 = document.querySelector('#image4').src = "images/image5.jpg";
image5 = document.querySelector('#image5').src = "images/image1.jpg";
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<body>
<img src="images/image1.jpg" id="image1"/>
</body>
<script src="step01.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var img = document.getElementById('image1')

img.addEventListener('mouseover', function () {
img.style = 'border: 3px solid red';
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
<title>Step 2</title>
</head>
<body>
<a href="#" id="show">Show</a>
<a href="#" id="hide">Hide</a>
<a href="#" onclick="showhide(0)" id="show">Show</a>
<a href="#" onclick="showhide(1)" id="hide">Hide</a>
<div id="texte">
<p>Joseph Dacre Carlyle (Carlisle, 4 juin 1758 - Newcastle upon Tyne, 12 avril 1804) est un orientaliste anglais.Après ses études à l'université de Cambridge, il y devint professeur d'arabe. En 1799, il fut attaché par le gouvernement britannique à l'ambassade de Lord Elgin dans l'Empire ottoman. Il était chargé d'explorer les bibliothèques de la région (principalement celle du Sérail) pour y découvrir (et y acquérir) des manuscrits inédits de textes antiques. Il se rendit aussi en Égypte, en Terre sainte et au mont Athos. Sa mission fut, de son point de vue, un échec. Il acheta quelques centaines d'ouvrages, principalement dans les bazars de Constantinople, mais aucun ne contenait de texte inédit. Cependant, la façon dont certains manuscrits avaient été acquis, principalement ceux du patriarche de Jérusalem Anthème Ier, ainsi que la querelle entamée sur la plaine de Troie entre Carlyle et un autre professeur de Cambridge, Edward Daniel Clarke, allaient être utilisées, après la mort de Carlyle, contre Lord Elgin, dans les controverses autour de l'acquisition des « marbres d'Elgin ».De retour en Grande-Bretagne à l'automne 1801, Joseph Dacre Carlyle entama une traduction en arabe de la Bible. Sa mort en avril 1804 coupa court à ce travail.</p>
</div>
</body>
<script src="../step 2/step02.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function showhide(x){
if(x==0)
{
document.querySelector('p').style.display = "block"
}else if (x==1) {
document.querySelector('p').style.display = "none"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
<p>Tara, originellement nommée Antarctica puis Seamaster, est une goélette française destinée à la fois à l'exploration et à la défense de l'environnement. Dans le cadre de l'Année polaire internationale, en 2007-2008, ce voilier est utilisé en Arctique par l'expédition Tara Arctic dans le but de faire des relevés permettant de mieux comprendre les changements climatiques qui s'opèrent en Arctique. En 2009, dans le cadre de l'expédition Tara Oceans, Tara parcourt les mers et les océans dans une circumnavigation de trois ans afin d'étudier le piégeage des molécules de gaz carbonique (CO2) par les micro-organismes marins comme le plancton. En avril 2016, une nouvelle expédition est montée Tara Pacific dont l'objectif est de comprendre le corail, menacé par des facteurs humains et climatiques1.</p>
</div>
<div>
<div class="color green" ></div>
<div class="color red" ></div>
<div class="color blue" ></div>
<div class="color green" onclick="G()"></div>
<div class="color red" onclick="R()" ></div>
<div class="color blue" onclick="B()"></div>
</div>
<script src="../step 3/step03.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-03/step 3/step03.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var texts=document.getElementById('text');

function G() {
document.getElementById("text").style.color = "green";}

function R() {
document.getElementById("text").style.color = "red"; }

function B () {
document.getElementById("text").style.color = "blue"; }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<form>
<label for="password">password : </label><input type="text" name="password" value="" id="password" />
<label for="confirmation">Confirm : </label><input type="text" name="confirmation" value="" id="confirmation" />
<button type="button" name="button" >Test</button>
<button type="button" name="button" onclick="Test()" >Test</button>
</form>
<script src="./step04.js"></script>
</body>
</html>
</html>
14 changes: 14 additions & 0 deletions 03_Exercises/03_JavaScript/javascript-basics-03/step 4/step04.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var pass =document.getElementById('password');
var conf =document.getElementById('confirmation');

function Test(){
if(pass.value==conf.value){
alert("correct");
}
else{
conf.style ='border:1px solid red';
pass.style='border:1px solid red';

}

}
Loading