Javascript
Javascript
Introduction to JavaScript
Math, Date and String
Types of Scripts with suitable objects with Example
example DOM Objects
Control and looping structure Form Validation
Various Operators in Javascript Dynamic effect using
Array its Types JavaScript
Event Handling with Example
Unit Outcomes
</script>
9 International Institute of Management MASTER OF COMPUTER
Science (IIMS) APPLICATION
JavaScript Output
Writing into an HTML element, using innerHTML.
Writing into the HTML output using document.write().
Writing into an alert box, using window.alert().
Using innerHTML
To access an HTML element, JavaScript can use the
document.getElementById(id) method.
Using document.write():
<script>
document.write(5 + 6);
</script>
Using window.alert()
<script>
window.alert(5 + 6);
</script>
1 International Institute of Management MASTER OF COMPUTER
0 Science (IIMS) APPLICATION
JavaScript Output
Using innerHTML
<html>
<body>
<h2>My First Web Page</h2>
<p>My First Paragraph.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 10 +20;
</script>
</body>
</html>
<script>
document.write(5 + 6);
</script>
</body>
</html>
<< Zero fill left shift 5 << 1 0101 << 1 1010 10
Syntax Eg.
If(condition) If (mark>40)
{ {
statement/statements; alert (“student is pass”);
} }
else else
{ {
statement/statements; alert (“student is fail”);
} }
statement/statements;
}
Syntax if(result>=75)
If(expression/condition) {
statement/statements; printf(“Passed :Grade A++\n”);
else If(expression/condition) Else if(result>=60)
statement/statements; printf(“Passed :Grade B\n”);
else If(expression/condition) Else if(result>=55)
statement/statements; printf(“Passed :Grade C\n”);
else Else
statement/statements; printf(“Failed\n”);
for(expression1;expersion2;expression3) Eg:
{ For(i=1; i<=10; i++)
statement; {
for(expression1;expersion2;expression3) For(j=1; j<=i; j++)
{
statement; {
} document.write(“Hello World”);
} document.write(“%d”, i);
}
}
onmouseout script Script runs when mouse pointer moves out of an element
onmouseover script Script runs when mouse pointer moves over an element