Uploaded by C/raxman C/rizaaq

REVISION JAVASCRIPT

advertisement
REVISION JAVASCRIPT
1. Explain overflow and its properties?
controls what happens to content that is too big to fit into an area. You can place multiple text
pages
2. The overflow properties has the following value?
 Visible: default, is not clipped. The content renders outside the element's box
 Hidden: The overflow is clipped, and the rest of the content will be invisible
 Scroll: The overflow is clipped, and a scrollbar is added to see the rest of the content

Auto : Similar to scroll, but it adds scrollbars only when necessary
Note: The overflow property only works for block elements with a specified
height.
What is dimension in CSS?
Dimensions in CSS: To specify the height and width of an element
What is the box model of CSS?
Is used when talking about design and layout.
What are the four components of CSS Box Model?
Margins, borders, padding, and the actual content.




Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
The display Property?
The display property is the most important CSS property for controlling
layout.
The default display value for most elements is block or inline.
Difference between Inline and Block Elements in HTML?
Inline elements never start from a new line. Block elements cover space from left to right
as far as it can go. Inline elements only cover the space as bounded by the tags in the
HTML element. Block elements have top and bottom margins.
The position Property
The position property specifies the type of positioning method used for an
element (static, relative, fixed, absolute or sticky).
What is the position of static relative fixed absolute sticky?
Static - this is the default value, all elements are in order as they appear in the
document.
Relative - the element is positioned relative to its normal position.
Absolute - the element is positioned absolutely to its first positioned parent.
Fixed - the element is positioned related to the browser window.
A sticky element toggles between relative and fixed, depending on the scroll position.
Introduction to scripting?
What is script identification?
Script identification is the process of identifying corresponding script(s) of a language in a
particular document image.
Java script?
Scripting language, used perform certain task.
Types of scripting?
 Client side scripting
 Server side scripting
The three types of JavaScript input?
In the head and body, put the external page that you want to link to
Control statements in JavaScript?
Is used to control the execution of a program based on a specific condition.
Two types of control statement?
 Conditional statement.
 Selection statement.
 Loops statement.
Conditional statement:



Use if to specify a block of code to be executed, if a specified condition is
true
Use else to specify a block of code to be executed, if the same condition is
false
Use else if to specify a new condition to test, if the first condition is false
Selection statement:

Use switch to specify many alternative blocks of code to be executed
The switch statement is used to perform different actions based on different
conditions.
The default keyword specifies the code to run if there is no case match:
Switching Details
If multiple cases matches a case value, the first case is selected.
If no matching cases are found, the program continues to the default label.
If no default label is found, the program continues to the statement(s) after
the switch.
JavaScript Loops
Loops are handy, if you want to run the same code over and over again, each
time with a different value.



for - loops through a block of code a number of times
for/in - loops through the properties of an object
for/of - loops through the values of an alterable object


while - loops through a block of code while a specified condition is true
Do/while - also loops through a block of code while a specified condition is
true.
Summery
For loop:
 Initiation
 Condition
 increment
While loop:
 each goes to a certain place
 Initiation.
 Condition
 increment
Do-while loop:
 Every time a statement is executed and then the condition follows
Write now the code of js
<html>
<head>
<script>
document.writeln("<h1 style=color:green >ikraan ahmed
salah</h1>")
document.writeln("<h3>22842</h3>")
document.writeln("<h3>ict</h3>")
document.writeln("<h3>class morning</h3>")
document.writeln("<img src=3.jpg hight=200px width=300px>")
alert("welcome back ")
switch code
var city
var cityint
city=window.prompt("select your city")
cityint=parseInt(city)
switch(cityint)
{
case 1:document.write("hargeisa")
break;
case 2:document.write("burco")
break;
case 3:document.write("berbera")
break;
case 4:document.write("boorama")
break;
case 5:document.write("ceerigaabo")
break;
case 6:document.write("laascanood")
break;
defualt:document.write("select 1,2,3,4,5,6")
}
Loops code
for(count=1;count<=10;++count)
{
document.write(count)
}
var count=1
while(count<=10)
{
document.write(count)
count++
}
var count=1
do
{
document.write(count)
count++
}
while(count<=10)
if/else code
</script>
</head>
<Body>
</body>
</head>
</html>
Download