Js Assignments
Js Assignments
4. create a textarea with id="comments".create a div with id="mydiv" and background color
Add the onkeyup() to the textarea to call the function printMessage()
In the function get the value of the textarea using getElementById() and assign to "comment"
get the div using getElementById and assign to "divElement"
Assign the variable "comment" to the div using innerHTML
I
5. create a dropdown with the list of courses using select with id="courseName"
Add the onchange() to the select tag to call the function showDetails()
In the function get the value of the select tag using getElementById() and assign to "course"
get the div using getElementById and assign to "divElement"
Assign the variable "course" to the div using innerHTML
1.
2.
3.
4. 1. register.html
5. create a form with form fields as
6. name, password, age (number),gender, course name(dropdown with course names),hobby(checkbox
with hobbies),
7. phone number
8.
9. Validation for this form
10. name - between 5 and 15
11. password - alphabets, uppercase, lowercase, specialchar, number between 5 to 15
12. age - 20-80
13. gender - one should be checked
14. cousrename ---select---
15. phone number 10 numbers
16. date of birth not below 1998
17.
18. submit button as register- on submit call register() function-
19. if something is wrong --------alert(please enter password)
20. ------->alert "registered successfully"
21.
22. 2. newregister.html, success.html [Local Storage]
23. In the same form after submit------> success.html
24. validation has to be done
25. on submit call register() function. After validation --------> print the form details(name,age,course) in
success.html
26.
27.3. login.html
28. username
29. email
30.on submit-------> call login() function
31. create an array with usernames =['Rohan','Raju','Ram'].
32. check if the name is in the array. If the name is not available then alert invalid username
33. if the name is in the array. alert Welcome <username>