Professional Documents
Culture Documents
UIJAVAKIT
UIJAVAKIT
Syntax:
Programming Language(C):
Inline Elements:
Ex: Can you display three players names in the same line?
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span>Sachin</span>
<span>Dhoni</span>
<span>Kohli</span>
</body>
</html>
Block Level Elements:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>Sachin</div>
<div>Dhoni</div>
<div>Kohli</div>
</body>
</html>
Attribute:
Ex:
Ex:
Input Controls:
Text Box:
<input/>
<input type="text" />
Password Box:
Ex:
Radio button:
Ex:
checkbox:
Ex:
Dropdown:
Ex:
<select>
<option>India</option>
<option>Pak</option>
<option>China</option>
</select>
textarea:
Ex:
File Upload:
Ex:
HTML TAGS:
title:
script:
link:
2.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href=" href="your css
file path"" />
<script src=" href="your js file path""></script>
</head>
<body>
//content to show in browser
</body>
</html>
iframe:
<iframe src="http://www.uijavakit.com"></iframe>
<iframe width="420" height="345"
src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>
image:
Table:
<table border='1px'>
<tr>
<th>Name</th>
<th>Runs</th>
</tr>
<tr>
<td>Sachin</td>
<td>20000</td>
</tr>
<tr>
<td>Dhoni</td>
<td>18000</td>
</tr>
</table>
ul:
<ul>
<li>Sachin</li>
<li>Dhoni</li>
<li>Kohli</li>
<li>UV</li>
</ul>
ol:
<ol>
<li>Sachin</li>
<li>Dhoni</li>
<li>Kohli</li>
<li>UV</li>
</ol>
a(anchor):
CSS
Introduction:
CSS stands for Cascading Style Sheets.
Using CSS, we can control the way of display HTML elements
in browser.
If you wants to see the applied styles to the element, open
developer window(by inspect or click on f12), click on
elements tab, click one of element and see the styles in the
right side to that element.
We can apply the styles to elements, in the form of
properties, like key value pairs.
CSS always tells the behavior of elements.
Browser always reads your CSS and format your elements
accordingly
We can apply styles in three ways.
1. Inline
2. Internal
3. External
Inline Styling:
Ex:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span style="color:red">Sachin</span>
<span style="color:red">Dhoni</span>
</body>
</html>
Drawbacks:
Internal Styling:
syntax:
selector }
property key:value;
property key:value
}
Ex:
1.html
<!DOCTYPE html>
<html>
<head>
span {
color:red
}
</head>
<body>
<span>Sachin</span>
<span>Dhoni</span>
</body>
</html>
2.html
<!DOCTYPE html>
<html>
<head>
span {
color:red
}
</head>
<body>
<span>Sachin</span>
<span>Dhoni</span>
</body>
</html>
Drawbacks:
External Styling:
syntax:
styels.css
selector }
property key:value;
property key:value
}
Ex:
styles.css
span{
color:red
}
1.html
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' href="styles.css" >
</head>
<body>
<span>Sachin</span>
<span>Dhoni</span>
</body>
</html>
2.html
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' href="styles.css" >
</head>
<body>
<span>Sachin</span>
<span>Dhoni</span>
</body>
</html>
Box Model:
Content:
Ex:
<div>Sachin</div>
Border:
To represent the bounds of your element.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
div {
border:1px solid red ;
}
</style>
</head>
<body>
<div>Sachin</div>
</body>
</html>
Padding:
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
div {
border:1px solid red
padding:10px 20px 30px
}
</style>
</head>
<body>
<div>Sachin</div>
</body>
</html>
Margin:
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
#div1 {
border:1px solid red
margin-bottom:10px
}
#div2 {
border:1px solid red
margin-top:10px
}
</style>
</head>
<body>
<div id="div1">Sachin</div>
<div id="div2">Dhoni</div>
</body>
</html>
Positions:
static:
absolute:
relative:
fixed:
sticky:
Selectors:
Star(*):
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
* {
color: red
}
</style>
</head>
<body>
<span>Sachin</span>
<div>Dhoni</div>
</body>
</html>
TagName:
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
span {
color: red
}
</style>
</head>
<body>
<span>Sachin</span>
<div>Dhoni</div>
</body>
</html>
ID(#):
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
#span1{
color: red
}
</style>
</head>
<body>
<span id="span1" >Sachin</span>
<div>Dhoni</div>
</body>
</html>
Class(.):
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
.div1{
color: red
}
</style>
</head>
<body>
<span id="span1" >Sachin</span>
<div class="div1" >Dhoni</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
span:first-child{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<div>Dhoni</div>
</div>
<div>
<span>Kohli</span>
<span>Dravid</span>
<div>UV</div>
</div>
<div>
<div>Rayudu</div>
<span>Laxman</span>
</div>
</body>
</html>
:last-child
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
span:last-child{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<div>Dhoni</div>
</div>
<div>
<span>Kohli</span>
<span>Dravid</span>
<div>UV</div>
</div>
<div>
<div>Rayudu</div>
<span>Laxman</span>
</div>
</body>
</html>
:first-of-type
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<p>Dhoni</p>
<div>Ganguly</div>
<h1>Dravid</p>
<p>Rayudu</p>
</div>
</body>
</html>
:last-of-type
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p:last-of-type{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<p>Dhoni</p>
<p>Ganguly</p>
<h1>Dravid</p>
<div>Rayudu</div>
</div>
</body>
</html>
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
div>h1{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<h1>Dravid</h1>
<p>Rayudu
<h1>Laxman</h1>
</p>
</div>
</body>
</html>
Result: Dhoni and Dravid h1 elements into red color.
Space( )
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
div h1{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<h1>Dravid</h1>
<p>Rayudu
<h1>Laxman</h1>
</p>
</div>
</body>
</html>
Result: Dhoni,Laxman,Dravid h1 elements into red color.
Plus (+)
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
h1+p{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<p>Laxman</p>
<h1>Dravid</h1>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Ganguly p element into red color.
Tilde (~)
<!DOCTYPE html>
<html>
<head>
<style>
h1 ~ p{
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<p>Laxman</p>
<h1>Dravid</h1>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Ganguly, Laxman p elements into red color.
:nth-child()
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
p:nth-child(4){
color:red
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<p>Laxman</p>
<h1>Dravid</h1>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Laxman p element into red color.
Attribute[]
It selects all the elements with matching attribute.
Ex:
<!DOCTYPE html>
<html>
<head>
<style>
[name=n1]{
color:red
}
</style>
</head>
<body>
<div>
<span name="n1">Sachin</span>
<h1 name="n1">Dhoni</h1>
<p name="n1">Ganguly</p>
<p>Laxman</p>
<h1>Dravid</h1>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Sachin, Dhoni, Ganguly text elements into red color.
Media Queries:
Ex 1:
<!DOCTYPE html>
<html>
<head>
<style>
@media screen and (max-width:700px){
span{
color:red
}
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Red color applied for Sachin and Rayudu span elements at the time of the
screen width is less than 700px.
Ex 2:
<!DOCTYPE html>
<html>
<head>
<style>
@media screen and (min-width:700px) and (max-width:1000px){
span{
color:green
}
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<span>Rayudu</span>
</div>
</body>
</html>
Result: Green color applied for Sachin and Rayudu span elements at the time of the
screen width is grater than 700px and less than 1000px.
Ex 3:
<!DOCTYPE html>
<html>
<head>
<style>
@media screen and (min-width:1000px){
span{
color:yellow
}
}
</style>
</head>
<body>
<div>
<span>Sachin</span>
<h1>Dhoni</h1>
<p>Ganguly</p>
<span>Rayudu</span>
</div>
</body>
</html>
Result: yellow color applied for Sachin and Rayudu span elements at the time of the
screen width is grater than 1000px.
CSS Properties:
Box sizing:
box-sizing:border-box
(width + padding + border = width of element, height + padding + border = normal
height of an element)
Text Align:
text-align:left;
text-align:right;
text-aligh:center
Fonts:
font-weight:bold;
font-size:30px;
font-family:arial
Display:
display:inline;
display:block;
display:inline-block
Overflow:
overflow:hidden;
overflow:scrool;
Float:
float:left;
float:right;
float:clear;
Opacity:
z-index:
JavaScript
Introduction:
It's client side scripting languare, which is runnng in
browsers.
Using Java Script we can do dynamic oparations on HTML
elements.
Using Java Script, we can write client side validations
also.
If you wants to write some scripting in your html page, we
should have to write that code with in script tag only.
To write scripting out of html, crate one .js file and place
your code there, and load that .js file into html file using
script tag like
<script src="your js file path"></script>
Variables:
Functions/Methods:
Ex:
function f1()}
console.log('Hello...world')
}
//call function:
f1();
Result: Hello...world
Ex:
function f1(n)}
console.log(n)
}
//call function:
f1(10);
Result:10
Ex:
function f1()}
return "sachin";
}
//call function:
var name=f1();
Result: console.log(name)
Sachin
Note: function can return a number, string, boolean, array, object or one more
function.
Ex:
function f1(n1,n2)}
var c=n1+n2
returu c;
}
//call function:
var res=f1(10,20);
Result:console.log(res)
30
Anonymous functions:
Ex:
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function f1(f){
f();
}
//If you want to call that function we have to pass on argument, whose type
is function
f1(function(){
alert('done');
});
//If you observe above am calling f1 by passing one function, that function
is not having any name, so that ie anonymous function.
//It was called indirectly, by call f().
// so that the output is done in alert box.
</script>
</head>
<body>
</body>
</html>
Ex:
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function f1(f){
f();
}
//If you want to call that function we have to pass on argument, whose type
is function
//So that we can call f1 function as Higher order function.
</script>
</head>
<body>
</body>
</html>
Array Methods:
Ex:
var array=[10,20,30];
console.log(array[0]);
Result: 10
console.log(array[2]);
Result: 30
length
Ex:
var array=[10,20,30];
console.log(array.length);
Result: 3
push(---)
Ex:
var array=[10,20,30];
array.push(40);
Result: [10,20,30,40]
array.push(50,60,70);
Result: [10,20,30,40,50,60,70]
pop()
pop() used to remove an element from last index.
Ex:
var array=[10,20,30];
array.pop()
Result: 30
unshift(---)
Ex:
var array=[10,20,30];
array.unshift(40);
Result: [40,10,20,30]
array.unshift(50,60,70);
Result: [50,60,70,40,50,60,70]
shift()
Ex:
var array=[10,20,30];
array.shift()
Result: 10
indexOf(-)
Ex:
var array=[10,20,30];
array.indexOf(20)
Result: 1
array.indexOf(200)
Result: -1
array.indexOf(30)
Result: 2
array.indexOf(120)
Result: -1
Note: If you observe above one, if the element is there it return the index of the
element, if not there, it always returns -1.
lastIndexOf(-)
Ex:
var array=[10,20,30,20,10,20];
array.lastIndexOf(20)
Result: 5
array.lastIndexOf(200)
Result: -1
array.lastIndexOf(30)
Result: 2
includes(-)
Using includes(), we can check one element is there or not in the array. If there
it return true, if not it returns false.
It take one arguement.
Ex:
var array=[10,20,30];
array.includes(20)
Result: true
array.includes(200)
Result: false
array.includes(30)
Result: true
array.includes(120)
Result: false
Note: If you observe above one, if the element is there it returns true, if not it
returns false.
join(-)
join(-) , which is used to convert array into string with some delemeter.
Default delemeter is ','.
Ex:
var array=[10,20,30];
array.join()
Result:"10,20,30"
array.join('_')
Result: "10_20_30"
reverse()
Ex:
var array=[10,20,30];
array.reverse()
Result:[30,20,10]
concat(---)
Ex:
var array=[10,20,30];
array.concat(40,50)
Result: new Array create with this data[10,20,30,40,50]
forEach(-)
Ex:
var array=[10,20,30];
array.forEach(function(value,index)}
console.log(value);
})
every(-)
every(-), which is used to check array elements based on condition, which
return boolean value.
If all elements in the array,satisfied your condtion then returns true.
If minimum one element in the array, is not satisfied your condtion then
returns false.
Ex:
var array=[10,20,30];
array.every(function(value,index)}
return value > 5
})
Result: true
array.every(function(value,index)}
return value > 15
})
Result: false
some(-)
Ex:
var array=[10,20,30];
array.some(function(value,index)}
return value > 15
})
Result: true
array.some(function(value,index)}
return value > 50
})
Result: false
filter(-)
filter(-), which is used to filter the elements in the array based on condition,
which return array.
Ex:
var array=[10,20,30];
array.filter(function(value,index)}
return value > 15
})
Result: [20,30]
array.filter(function(value,index)}
return value > 25
})
Result: [30]
find(-)
Ex:
var array=[10,20,30];
array.find(function(value,index)}
return value == 20
})
Result: 20
array.find(function(value,index)}
return value == 25
})
Result: undefined
findIndex(-)
Ex:
var array=[10,20,30];
array.findIndex(function(value,index)}
return value == 20
})
Result:1
array.findIndex(function(value,index)}
return value == 25
})
Result: -1
sort(-)
sort() with out arguments, which is used to sort an elements in the array based
on dictionary sorting, suitable for alphabets.
sort(-) with arguments, which is used to sort an elements in the array by return
number(+ve,-ve,0),suitable for numbers.
Ex:
var array=["Sachin","Dravid","Kohli"];
array.sort()
Result:['Dravid','Kohli','Sachin']
var array=[1,10,11,2,22,3,5]; array.sort()
Result:[1,10,11,2,22,3,5] //wrong out put
array.sort(function(value1,value2)}
return value1-value2
})
Result:[1,2,3,5,10,11,22]
slice(-,-)
Ex:
var array=[1,10,11,2,22,3,5];
array.slice(1,3)
Result:[10,11]
splice(-,-,-)
Ex:
map(-)
map(-), if you wants to perform same oparaton on each and every element in
the array , then go with map.
Ex:
var array=[1,2,3,4,5];
array.map(function(value,index)}
return value+1
})
Result:[2,3,4,5,6]
reduce(-)
Ex:
var array=[1,2,3,4,5];
array.map(function(initVal,value)}
initVal=initVal+value
return initVal
})
Result:15