JavaScript
•
à
Browsers have limited functionality
–
Text, images, tables, frames
•
JavaScript allows for interactivity
•
Browser/page manipulation
–
Reacting to user actions
•
JavaScript is the programming
language of the Web.
•
All modern HTML pages are using
JavaScript.
•
JavaScript is easy to learn.
Q1. Write a javascript code to print the ‘Welcome
User’ by using the following methods:
1)
document.write
2)
Window alert
3)
innerHTML
Exercise-popup boxes
Q2. Create a simple JavaScript file “hello.js”
that contains an alert box to the page and embed your JavaScript within HTML
page “hello.html”.
Q 3: Write a program to give the alert to the user
about the information of today appointments.
Q 4: Write a program to confirm from the user whether
he/she want to proceed.
Q 5: Write a program to ask the age from the user.
Exercise-Variable
Q 6: Write a program that asks the user for his name
and greets him with his name.
Exercise-Operators
Q7: Write a JavaScript program to find the volume of a
cuboid where lengths of the three of its sides are 5, 6, 7.
Exercise-Array & Function
Q8: Define a function sum() and a
function multiply() that sums and multiplies (respectively) all the numbers in
an array of numbers. For example, sum([1,2,3,4]) should return 10, and
multiply([1,2,3,4]) should return 24.
Exercise: If-Else
Q9: Write a JavaScript program that accept two
integers and display the larger.
Q10: Write a JavaScript conditional statement to sort
three numbers. Display an alert box to show the result
Exercise: for-loop
Q12: Write a JavaScript for loop that will iterate
from 0 to 15. For each iteration, it will check if the current number is odd or
even, and display a message to the screen.
Sample Output :
"0 is even"
"1 is odd"
"2 is even"
----------
----------
"0 is even"
"1 is odd"
"2 is even"
----------
----------
Q13: Write a JavaScript function
that reverse a number
Exercise – Form & Event
Q14. Write a JavaScript program to calculate
multiplication and division of two numbers (input from user).
Exercise – Form & Event(Cont.)
Q.15 A form displays two text boxes and two radio
buttons. The first text box accepts a numeric value. If the first radio button
is active, double the number entered in the first box and display in the second
text box. If the second radio button is active, square of the number entered in
the first field is to be displayed in the second text box.
Q. 16 Create a HTML form that has number of Textboxes.
When the form runs in the Browser fill the textboxes with data. Write JavaScript
code that verifies that all textboxes has been filled. If a textboxes has been
left empty, popup an alert indicating which textbox has been left empty.
Comments
Post a Comment