0% found this document useful (0 votes)
4 views

Java Script

jss

Uploaded by

prabitjoshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Java Script

jss

Uploaded by

prabitjoshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Java Script: <script language ="javascript ">

Java Script is light weight interpreted programming document.write("Today ICT class is Run")
language with object oriented capabilities . </script>
 Java Script language is case sensitive . Output
 It is also known as live script . Today ICT class is Run
 It is directly or indirectly embedded in HTML page.
 The java script language resemble c, c++ , Java . For HTML Code :
 All major Web browser like internet Explorer, <HTML>
Mazola firebox , Netscape Navigator , Opera and etc <Title>First Javascript program </title>
supported it . <body>
<script language="javascript">
Use of JavaScript : document.write("Today ICT class is Run");
1. Used for validative form . </script>
2. Displaying clock . </body>
3. display alter message . </HTML>
4. perfroming calculation and display result Output
on client side . Today ICT class is Run
Script is the head section : Script to be executed when they
Advantage of JavaScript : are called . Script in the body section : Script to be execution
1. Cross browser support . when the webpage lodes go in the body section .
2. Loght weight for fast downloading . The word document , write is a standard java script
3. Similaritics of C language . commands or displaying output message .
4. It is easy to learn and wirting code of program Question no 1. Write a program to calculate Multiplication of
5. It support in bulit software . three different number.
<script language="javascript">
Disadvantage of the javaScript : var a,b,c,multi;
1. Read and writing files can't be server side , only for a=parseInt(prompt("Enter the 1st number :"));
client side . b=parseInt(prompt("Enter the 2nd number :"));
2. All web browser can't be support it . c=parseInt(prompt("Enter the 3rd number :"));
multi=a*b*c;
Today ICT class is Run : document.write("The multiplication of three no.is:"+multi);
</script>
Output </script >
Output:

The remainder of two no.is:1


Question no 4. Write a program to calculation area of circle .
<script language="javascript">
var r, area_of_circle ;
r=parseFloat(prompt("Enter the radius :"));
area_of_circle=3.14*r*r;
document.write("The area of circle is :"+ area_of_circle);
</script>
The multiplication of three no.is: 1728
Question no 2. Write a program to display remained of two different Output
number .
<script language="javascript">
var x,y,rem;
x=parseInt(prompt("Enter the 1st number :"));
y=parseInt(prompt("Enter the 2nd number :"));
rem=x%y;
document.write("The remainder of three no.is:"+rem);
The area of circle is :78.5 The volume is :64

Write a program to calculation Volume V=(l*b*h)


<script language="javascript"> Client Side :
var l,b,h,vol; Run when a java script interpret embedded in a web browser the
l=parseInt(prompt("Enter the values of the length is :")); result is client side Java script . This is the most common variable of
b=parseInt(prompt("Enter the values of the breadth is :")); JavaScript when most pupil or user refer to java script , they usually
h=parseInt(prompt("Enter the values of the height is :")); mean client side JavaScript enable executable contain to be disrupted
vol=l*b*h ; over the web .
document.write("The volume is :"+vol);
</script> Server side JavaScript:
Output Server side java script is providing in AlterNet CGA
(common Gateway interface) script .
 They can works with files , database etc .
 They can directly work with or embedded with HTML file.
 In server side java script are pre-compiler to a binary .
 It is faster to execute a program then CGI script .

Integer :
 In Java script it sizes 8 bytes .
 It is used to store integers numbers (single number)
 It can also contain Octal and Hexadecimal values.

Semi colon :
In javascript semi-colons are optional .
String :
It is simply communication of character that do not
change during the execution of program .

Example :
Operator :
In JavaScript operator is symbols which used in calculation or
manipulate different types of operators.
Operator can be classification in different categories:
1. Arithmetic operator
2. Comparison operator
3. Equality operator
4. Logical operator
5. Assignment operator
6. Bit wise operator

A. Arithmetical Operator :
It take numerical values as their operator and return a
single numerical values. The standard arithmetical operator is addition
subtraction, division, multiplication and remainder. This operator work
as they do in must other programming language. Java script provides the
arithmetical operators following so on.
Operators Description Example The volume is :3510
% (Modular) Return the integer 12%2=2
Question no 9: Write a program to input any number and
remainder of dividing
the two operator . find enter number is even and odd .
+ <script language="javascript">
var n;
n=parseInt(prompt("Enter the values of n is :"));
Program: if (n%2==0)
Write a program to calculation area of rectangle . {
/*Write a program to calculation area of rectangle.*/
<script language="javascript">
document.write(“It is even number”);
var l,b,rec; }
l=parseInt(prompt("Enter the values of the length is :")); else
b=parseInt(prompt("Enter the values of the breadth is :"));
rec=l*b ;
document.write("It is odd mumber”);
document.write("The volume is :"+rec); </script>
</script>
Output:

You might also like