DAY 12 13 Excercise
DAY 12 13 Excercise
#1 Program
Create an html form with a textbox and button, Click the button to display a confirm box.
If Yes is pressed then display Given Text in textbox + " - u pressed Yes" and if you press No then display
Given text in textbox + " - U have pressed No"
Validation: If no text is given in the textbox then raise an alert “Please enter a text
#2 Program
Create an html form with a textbox and button and a div, Click the button to do the following. Use
separate function for each action
RESULTS:
Length:______
Upper:_________
Lowerr:________
InitCap:______
#3 Program
Create an html form to accept the below field and validate the data and print “Form Validation
success.”, if all the validation are success. And also print the sum and average of marks to the text boxes
inside the form.
1. Student ID (Aphla-nuberic, length = 5, First letter should be Alpha and rest should be a number)
2. Student name (Length <= 20,, no special characters except DOT(.) )
3. Age (Length = 2, only numbers)
3. Gender (Length = 1, only M/F)
4. English mark (Length = 6, only numbers and DOT(.) allowed)
5. Tamil mark (Length = 6, only numbers and DOT(.) allowed)
6. Maths mark (Length = 6, only numbers and DOT(.) allowed)
7. Scneice mark (Length = 6, only numbers and DOT(.) allowed)
8. Social mark (Length = 6, only numbers and DOT(.) allowed)
RESULTS:
Total Marks
Average Marks
#4 Program:
Create a HTML form which will have a text box and a button. Write a java script to get the input from the
text box and print the respective month in the alert box. If the number is not a valid month then raise an
error? – Use case statement for checking.
Javascript–Exercise
#5 Program
Create an html form that has 3 button with caption “hotcourses.com”, “hotcoursesusa.com” and
“myhotcourses.com”
When clicking on the buttons it will open the website ‘http://www.hotcourses.com’,
‘http://www.hotcoursesusa.com’ and ‘http://www.myhotcourses.com’ respectively in a 3 separate popup
window.
# 6 Program:
Create an html form with the text box to accept a color code and add the below data to the dropdown and
a button.
CODE NAME
1 Red
2 Blue
3 Green
4 Yellow
5 Orange
6 Black
7 White
8 Brown
9 Pink
10 Grey
Enter a color code and click the button, match the color code in the dropdown and check the color name
in the dropdown and print in the alert box.
#7 Program:
Create a HTML form which will have a text box and a button. Write a java script and do the following
and print the data inside textarea. Use separate function for each action
#8Program:
Create a HTML form which will have a 3 text box, dropdown and button. Add below value to the
dropdown, on clicking the button, Write a java script to get the input value from the first 2 text boxes and
do the following based on the value selected in the dropdown and store to 3 text box, USE separate
function for each action along with switch statement.
<Amstrong numbers>
<Perfect Numbers>
<Add All numbers>
<Odd numbers>
<Even numbers>
Based on the option selected process the data in textbox1 and textbox2 and show the result in textbox3.
Javascript–Exercise
#9 Program:
Create a HTML form with 2 dropdown (dropdown-1 and dropdown-2) in dropdown-1 add the below
datas and a button.
On clicking the button, using the JavaScript copy all the content from dropdown-1 to dropdown-2
#10 Program:
Create a HTML form and create 5 <DIV> and add some content in each div and hide all the divs, add
below data to a dropdown, on changing the dropdown show the selected div and hide all the divs
#11 Program
Create a HTML form which will have a text box and a button. Write a java script to get the input from the
text box and print the below result in alert, if not number then raise error. Use (if-else)
#12 Program:
Create a HTML form which will have a text box and a button. Write a java script to get the input from the
text box and print the below result in a single alert,
Date should be ??/??/???? if not then raise error else do the below - USE Array
1. Leap year?
2. No of days in the month?
3. Month name?